Hi!
I have a table with many columns. But I wrote these codes to update ONLY the exact date for a specific column ‘anex’ row. But curiosly its update the all columns ‘date’, name and anex with the same date he found on the maskeedit. After to make my filter I need him to update ONLY the ‘anex’ column row (not the all column).
private void test_Click(object sender, EventArgs e)
{
{
conn = new OleDbConnection(connstr);
comm = new OleDbCommand();
conn.Open();
OleDbParameter date = new OleDbParameter("@date", SqlDbType.VarChar);
OleDbParameter name = new OleDbParameter("@name", SqlDbType.VarChar);
OleDbParameter anex = new OleDbParameter("@anex", SqlDbType.VarChar);
comm.Parameters.Add(date);
comm.Parameters.Add(name);
comm.Parameters.Add(anex);
date.Value = date.Text;
name.Value = name.Text;
anex.Value = anex.Text;
comm.Connection = conn;
comm.CommandText = "UPDATE test SET date = @date, name = @name, anex = @anex WHERE ([date] = @date)";
try
{
comm.ExecuteNonQuery();
MessageBox.Show("Updated");
}
catch (Exception)
{
MessageBox.Show("Not Updated");
}
finally
{
conn.Close();
IsraelPosted Mar 24, 2015, 9:42 AM
You didnt give any attention to my question. Your codes doesnt work.
@Pankaj Kumar Choudhary
I love when things doesnt work... Then later there is a solution. Thanx very much. Its works as I need. You give good attention to my question.
Pankaj Kumar ChoudharyPosted Mar 23, 2015, 1:02 PM
Khargesh RajputPosted Mar 23, 2015, 11:41 AM