Qestion: What is the error in following code ??
OleDbConnection con = new OleDbConnection(constring);
con.Open();
string str1="Update facultyload set FacultyName=@p1,Batch=@p2,Time=@p3,StartDate=@p4,Schedule=@p5 Where fid=@p6";
OleDbCommand updatecmd = new OleDbCommand(str1, con);
updatecmd.Parameters.AddWithValue("@p6", textBox4.Text);
updatecmd.Parameters.AddWithValue("@p1", textBox1.Text);
updatecmd.Parameters.AddWithValue("@p2", comboBox1.Text);
updatecmd.Parameters.AddWithValue("@p3", textBox2.Text);
updatecmd.Parameters.AddWithValue("@p4", dateTimePicker1.Text);
updatecmd.Parameters.AddWithValue("@p5", comboBox2.Text);
updatecmd.ExecuteNonQuery();
MessageBox.Show("Record Updated");
con.Close();


Manas MohapatraRank #182 · 13.2K reputationPosted Aug 3, 2015, 2:59 AM EDT
Vipin Saxena162 reputationPosted Aug 3, 2015, 8:35 PM EDT
Manas MohapatraRank #182 · 13.2K reputationPosted Aug 3, 2015, 8:49 PM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Aug 3, 2015, 9:00 PM EDT
OleDbConnection con = new OleDbConnection(constring);
con.Open();
string str1 = @"Update facultyload set FacultyName=@p1,Batch=@p2,Time=@p3,StartDate=@p4,Schedule=@p5 Where fid=@p6";
OleDbCommand updatecmd = new OleDbCommand(str1, con);
updatecmd.Parameters.AddWithValue("@p6", textBox4.Text);
updatecmd.Parameters.AddWithValue("@p1", textBox1.Text);
updatecmd.Parameters.AddWithValue("@p2", comboBox1.Text.ToString());
updatecmd.Parameters.AddWithValue("@p3", textBox2.Text);
updatecmd.Parameters.AddWithValue("@p4", dateTimePicker1.Text);
updatecmd.Parameters.AddWithValue("@p5", comboBox2.Text.ToString());
updatecmd.ExecuteNonQuery();
MessageBox.Show("Record Updated");
con.Close();
Vipin Saxena162 reputationPosted Aug 19, 2015, 10:09 PM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Aug 19, 2015, 11:38 PM EDT