Updating SQL2005 table containing timestamp column

  • Thread starter Thread starter Guest
  • Start date Start date
Hi Mal,

IMO, the update method in Customer class should not have any arguments.
Because calling Update is updating the very object you're calling this
method on. You can change the method to

public void Update()
{
try
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["ToolkitServer"].Connec
tionString);
SqlCommand cmd = new SqlCommand("updatecustomer", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@customerid", SqlDbType.Int);
cmd.Parameters["@customerid"].Value = this.CustomerID;
cmd.Parameters.Add("@customername", SqlDbType.NVarChar);
cmd.Parameters["@customername"].Value = this.CustomerName;
cmd.Parameters.Add("@address1", SqlDbType.NVarChar);
cmd.Parameters["@address1"].Value = this.Address1;

//................................
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
catch (Exception ex)
{
}
}

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Thanks for all your help, I am giving up on this and doing it some other way
I cannot get it to work and its taking too much time up. Now that I have
removed the parameter in the Update method I am getting this error:

ObjectDataSource 'ObjectDataSource1' could not find a non-generic method
'Select' that has parameters: customerID, customername, details, address1,
address2, town, county, postcode, country, phone, web, fax,
original_CustomerID.
 
Hi Mal,

It seem the problem is in the Select method. Please check if the bounded
parameters are the same as the Select method.

Looking at this issue, I think it needs intensive troubleshooting. I
suggest you try to contact Microsoft PSS on it. You can find their contact
information from the following link:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;OfferProPhone

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top