Hi,
I am trying to update the customer table by using the updatecommd,
please see
below, however, when it runs it does not fire the update statement. I
ran the sql profiler
and the only statement the profiler shows is the 'Select * from
Customers...' and zero
rows updated.
Does any knwo why the updatecommand does not fire.
Thanks in advance
Regards,
----------------------------------------------------------------------------------------
.... code sample
[color=blue]
> cmd = New SqlClient.SqlCo mmand("Select * from
> Northwind.dbo.C ustomers ", consql)
> adapter.SelectC ommand = cmd
> ' read customer table
> adapter.Fill(da tatable1)
>
> ' update customer
> cmd = New SqlClient.SqlCo mmand("UPDATE
> Northwind.dbo.C ustomers SET CustomerID =
> @CustomerID, CompanyName =
> @CompanyName "& _
> "WHERE CustomerID =
> @oldCustomerID" , consql)
>
> cmd .Parameters.Add ("@CustomerI D", SqlDbType.NVarC har,[/color]
10,[color=blue]
> "CustomerID ")
> cmd .Parameters.Add ("@CompanyName" , SqlDbType.NVarC har,[/color]
40,[color=blue]
> "CompanyNam e")
>
> ' update database
> adapter.UpdateC ommand = cmd
> adapter.Update( datatable1)
>[/color]
I am trying to update the customer table by using the updatecommd,
please see
below, however, when it runs it does not fire the update statement. I
ran the sql profiler
and the only statement the profiler shows is the 'Select * from
Customers...' and zero
rows updated.
Does any knwo why the updatecommand does not fire.
Thanks in advance
Regards,
----------------------------------------------------------------------------------------
.... code sample
[color=blue]
> cmd = New SqlClient.SqlCo mmand("Select * from
> Northwind.dbo.C ustomers ", consql)
> adapter.SelectC ommand = cmd
> ' read customer table
> adapter.Fill(da tatable1)
>
> ' update customer
> cmd = New SqlClient.SqlCo mmand("UPDATE
> Northwind.dbo.C ustomers SET CustomerID =
> @CustomerID, CompanyName =
> @CompanyName "& _
> "WHERE CustomerID =
> @oldCustomerID" , consql)
>
> cmd .Parameters.Add ("@CustomerI D", SqlDbType.NVarC har,[/color]
10,[color=blue]
> "CustomerID ")
> cmd .Parameters.Add ("@CompanyName" , SqlDbType.NVarC har,[/color]
40,[color=blue]
> "CompanyNam e")
>
> ' update database
> adapter.UpdateC ommand = cmd
> adapter.Update( datatable1)
>[/color]
Comment