hello
(1) i used search data users information from textbox , its display info all in textbox (2)
(3+2) then i insert just data + date into table vacation
so i want update or add this (A+B) date vacation to user in table_infoname
i would like also while insert data also update those date (A+B) into user info from table_infoname
(2)
com.Parameters.AddWithValue("@name", txtUsername.Text.ToString());
com.Parameters.AddWithValue("@civilid", civilid.Text.ToString());
(A+B)
com.Parameters.AddWithValue("@DateTimePicker1", System.Data.SqlDbType.DateTime).Value = DateTimePicker1;
com.Parameters.AddWithValue("@DateTimePicker2", System.Data.SqlDbType.DateTime).Value = DateTimePicker2;
//add report from Table_vacation
protected void Insert(object sender, EventArgs e)
{
string IpassAstringfrompage1 = Convert.ToString(Session["Name"]);
string filename = Path.GetFileName(FileUpload2.PostedFile.FileName);
string contentType = FileUpload2.PostedFile.ContentType;
using (Stream fs = FileUpload2.PostedFile.InputStream)
{
using (BinaryReader br = new BinaryReader(fs))
{
byte[] bytes = br.ReadBytes((Int32)fs.Length);
string constr = ConfigurationManager.ConnectionStrings["kankonConnectionString"].ConnectionString;
SqlConnection con;
SqlCommand cmd;
using (con = new SqlConnection(constr))
{
string query = "insert into Table_vacation (idnamev,jop,eldarajah,el3malv,datesp10,idcivilv,datestart,dateend,vacationdata,totalva,infovacation,namevacation,iPAddress,dataaddtime,edit,Name,ContentType,backupmyfile) VALUES (@idnamev,@jop,@eldarajah,@el3malv,@datesp10,@idcivilv,@datestart,@dateend,@vacationdata,@totalva,@infovacation,@namevacation,@iPAddress,@dataaddtime,@edit,@Name,@ContentType,@backupmyfile)";
using (cmd = new SqlCommand(query))
{
cmd.Connection = con;
cmd.Parameters.AddWithValue("@Name", filename);
cmd.Parameters.AddWithValue("@ContentType", contentType);
cmd.Parameters.AddWithValue("@backupmyfile", bytes);
cmd.Parameters.AddWithValue("@idnamev", txtUsername.Text);
cmd.Parameters.AddWithValue("@jop", joptitel.Text);
cmd.Parameters.AddWithValue("@eldarajah", eldarajah.Text);
cmd.Parameters.AddWithValue("@el3malv", markazel3mel.Text);
cmd.Parameters.AddWithValue("@datesp10", filenumber.Text);
cmd.Parameters.AddWithValue("@idcivilv", civilid.Text);
cmd.Parameters.AddWithValue("@datestart", txtBoxDate.Text);
cmd.Parameters.AddWithValue("@dateend", txtBoxDate2.Text);
cmd.Parameters.AddWithValue("@vacationdata", txtBoxDate4.Text);
cmd.Parameters.AddWithValue("@totalva", lblLabel1.Text);
cmd.Parameters.AddWithValue("@infovacation", VacationList1.Text);
cmd.Parameters.AddWithValue("@namevacation", "اجازة دورية");
cmd.Parameters.AddWithValue("@iPAddress", IpassAstringfrompage1);
cmd.Parameters.AddWithValue("@dataaddtime", Convert.ToDateTime(DateTime.Now.ToLongTimeString()));
cmd.Parameters.AddWithValue("@edit", "(جديد)");
cmd.Connection = con;
try
{
con.Open();
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
con.Close();
}
}
}
}
Response.Redirect(Request.Url.AbsoluteUri);
}
}
SQL storedPro update user into table_infoname
ALTER PROCEDURE [dbo].[update_User2]
(
@name NVARCHAR(MAX),
@admin NVARCHAR(MAX),
@superadmin NVARCHAR(MAX),
@super NVARCHAR(MAX),
@civilid NVARCHAR(MAX)
)
as
begin
UPDATE Table_infoname
SET
name=@name,
civilid=@civilid,
admin=@admin,
super=@super,
superadmin=@superadmin
where civilid=@civilid
end