frankm9639
Active member
- Joined
- Aug 24, 2006
- Messages
- 25
- Programming Experience
- 1-3
I want to manually program a datagrid as an exercise in teaching myself how to update, insert, and delete to a dataset and db. Is this a bad thing to do? Anyway, I wanted to ask a question. When you create a data adapter with the wizard it creates the sql statements for you. When I created a data adapter manually, I copied the wizard created lines and tried to modify them. But, I'm getting an error. Can you help?
---------code------------
SqlCommand.CommandText = "UPDATE COMPANY SET CompanyName = @CompanyName WHERE CompanyKey = @CompanyKey"
SqlDA_COMPANY.UpdateCommand = SqlCommand
SqlCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar, 50)
SqlCommand.Parameters.Add("@CompanyKey", SqlDbType.NVarChar, 5)
-----error------------
Prepared statement '(@CompanyName nvarchar(50),@CompanyKey nvarchar(5))UPDATE COMPAN' expects parameter @CompanyName, which was not supplied.
---------error 2----------
An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: Cannot create a child list for field COMPANY.
-------------------------
---------code------------
SqlCommand.CommandText = "UPDATE COMPANY SET CompanyName = @CompanyName WHERE CompanyKey = @CompanyKey"
SqlDA_COMPANY.UpdateCommand = SqlCommand
SqlCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar, 50)
SqlCommand.Parameters.Add("@CompanyKey", SqlDbType.NVarChar, 5)
-----error------------
Prepared statement '(@CompanyName nvarchar(50),@CompanyKey nvarchar(5))UPDATE COMPAN' expects parameter @CompanyName, which was not supplied.
---------error 2----------
An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: Cannot create a child list for field COMPANY.
-------------------------