1
Answer

Updating from a label inserting sql query

Israel

Israel

9y
586
1
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)