sqlUpdateCommand1

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here is the code and the error stops with the "executenonquery"

sqlUpdateCommand1.Parameters["@Id"].Value = Request.QueryString["id"];
sqlUpdateCommand1.Parameters["@filnavn"].Value = TextBox2.Text;
sqlUpdateCommand1.Connection.Open();
sqlUpdateCommand1.ExecuteNonQuery();
sqlUpdateCommand1.Connection.Close();

sqlDataAdapter1.Fill(dataSet11);
TextBox1.DataBind();
 
The problem is that a i only want to update one or two fields, not the hole
table.
I get an error message that tell me i must update the hole table.
 
CJ,

To use the parameters you must specify a stored procedure for the command to
use or just explicitly write the update statement. For instance:

sqlUpdateCommand1.CommandText = "procnamegoeshere";
sqlUpdateCommand1..CommandType = CommandType.StoredProcedure;

OR

sqlUpdateCommand1.CommandText = "UPDATE TABLE1 SET Column1 = 'mytext'";
sqlUpdateCommand1..CommandType = CommandType.StoredProcedure;

I hope this helps.
 
Back
Top