protected void Button1_Click1(object sender, EventArgs e)
{
String path = Server.MapPath("App_Data\\dnis2010.mdb");
String sqlQuery = "UPDATE tableRegister SET (SerialNo,StaffName,StaffID,[Hostname],[Department],[Section],[Extension],Type,IpAddType,IpAdd,MacAdd,CpuBrand,CpuModel,Processor,HardDisk,HDType,RAM,RAMType,MonBrand,MonModel,MonSerialNo,MouBrand,MouModel,MouSerialNo,KeybBrand,KeybModel,KeybSerialNo,CdPlay,CdPlayBrand,CdPlayModel,CdPlayType,Windows,Other,WProdKey,MS,MSProdKey,SoftwareName,LicenceNo,Remarks) VALUES (@TextBox42,@TextBox1,@TextBox2,@TextBox3,@TextBox4,@TextBox5,@TextBox6,@TextBox40,@TextBox8,@TextBox9,@TextBox10,@TextBox11,@TextBox12,@TextBox13,@TextBox14,@TextBox15,@TextBox16,@TextBox17,@TextBox18,@TextBox19,@TextBox20,@TextBox21,@TextBox22,@TextBox23,@TextBox24,@TextBox25,@TextBox26,@TextBox27,@TextBox28,@TextBox29,@TextBox31,@TextBox32,@TextBox33,@TextBox34,@TextBox35,@TextBox36,@TextBox37,@TextBox38,@TextBox39) WHERE SerialNo=@TextBox41";
OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =" + path);
OleDbCommand aCommand = new OleDbCommand(sqlQuery, aConnection);
aCommand.Parameters.AddWithValue("TextBox42", TextBox42.Text);
aCommand.Parameters.AddWithValue("TextBox1", TextBox1.Text);
aCommand.Parameters.AddWithValue("TextBox2", TextBox2.Text);
aCommand.Parameters.AddWithValue("TextBox3", TextBox3.Text);
aCommand.Parameters.AddWithValue("TextBox4", TextBox4.Text);
aCommand.Parameters.AddWithValue("TextBox5", TextBox5.Text);
aCommand.Parameters.AddWithValue("TextBox6", TextBox6.Text);
aCommand.Parameters.AddWithValue("TextBox40", TextBox40.Text);
aCommand.Parameters.AddWithValue("TextBox8", TextBox8.Text);
aCommand.Parameters.AddWithValue("TextBox9", TextBox9.Text);
aCommand.Parameters.AddWithValue("TextBox10", TextBox10.Text);
aCommand.Parameters.AddWithValue("TextBox11", TextBox11.Text);
aCommand.Parameters.AddWithValue("TextBox12", TextBox12.Text);
aCommand.Parameters.AddWithValue("TextBox13", TextBox13.Text);
aCommand.Parameters.AddWithValue("TextBox14", TextBox14.Text);
aCommand.Parameters.AddWithValue("TextBox15", TextBox15.Text);
aCommand.Parameters.AddWithValue("TextBox16", TextBox16.Text);
aCommand.Parameters.AddWithValue("TextBox17", TextBox17.Text);
aCommand.Parameters.AddWithValue("TextBox18", TextBox18.Text);
aCommand.Parameters.AddWithValue("TextBox19", TextBox19.Text);
aCommand.Parameters.AddWithValue("TextBox20", TextBox20.Text);
aCommand.Parameters.AddWithValue("TextBox21", TextBox21.Text);
aCommand.Parameters.AddWithValue("TextBox22", TextBox22.Text);
aCommand.Parameters.AddWithValue("TextBox23", TextBox23.Text);
aCommand.Parameters.AddWithValue("TextBox24", TextBox24.Text);
aCommand.Parameters.AddWithValue("TextBox25", TextBox25.Text);
aCommand.Parameters.AddWithValue("TextBox26", TextBox26.Text);
aCommand.Parameters.AddWithValue("TextBox27", TextBox27.Text);
aCommand.Parameters.AddWithValue("TextBox28", TextBox28.Text);
aCommand.Parameters.AddWithValue("TextBox29", TextBox29.Text);
aCommand.Parameters.AddWithValue("TextBox31", TextBox31.Text);
aCommand.Parameters.AddWithValue("TextBox32", TextBox32.Text);
aCommand.Parameters.AddWithValue("TextBox33", TextBox33.Text);
aCommand.Parameters.AddWithValue("TextBox34", TextBox34.Text);
aCommand.Parameters.AddWithValue("TextBox35", TextBox35.Text);
aCommand.Parameters.AddWithValue("TextBox36", TextBox36.Text);
aCommand.Parameters.AddWithValue("TextBox37", TextBox37.Text);
aCommand.Parameters.AddWithValue("TextBox38", TextBox38.Text);
aCommand.Parameters.AddWithValue("TextBox39", TextBox39.Text);
aCommand.Parameters.AddWithValue("TextBox41", TextBox41.Text);
try
{
aConnection.Open();
int row = aCommand.ExecuteNonQuery();
ClientScript.RegisterStartupScript(typeof(Page), "PopUpMsg", "<script>alert ('Record Has Been Updated!');</script>");
aConnection.Close();
}
catch (Exception)
{
ClientScript.RegisterStartupScript(typeof(Page), "PopUpMsg", "<script>alert ('Fail to Updated!');</script>");
}
}
I've try to update my database but nothing happen..only popup message alert "Fail to Updated"..can anyone help me..