Israel

Israel

  • 691
  • 1.3k
  • 219.6k

Updating from a label inserting sql query

Feb 6 2015 7:31 AM
Hi!

I have on a form a label where appear one data after making filter. Then I would like to know how can I take this information appearing on that label to upadate on my sql query.
Please see my idea from this code (its desnt works):

comm = new OleDbCommand();
                conn.Open();
                OleDbParameter anex = new OleDbParameter("@anex", SqlDbType.NChar);
                comm.Parameters.Add(anex);
                anex.Value= lblAnex.Text;
                comm.Connection = conn;
                comm.CommandText = "UPDATE 1 SET [anexo]= lblAnex.Text WHERE ISNULL([anex]) OR [anex]='0'";// it's on this line
                comm.ExecuteNonQuery();
                conn.Close();

Answers (1)