updating database

nitin

Member
Joined
Mar 29, 2005
Messages
9
Programming Experience
Beginner
hi people.i want to ask like i have created a dataset using a sqldataadapter.now to in this dataset i have added new row in a table in dataset using addnew row command.now my problem is how wil i update this changes to the original database.

the error it gives is that an update command requires a a valid insert statement.

pls help me .
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
You'll need to add the insert command to you dataadapter and the column parameters like this:

VB.NET:
MyDataAdapter.insertcommand = new sqlclient.sqlcommand
MyDataAdapter.insertcommand.commandtext= YourInsertCommand
MyDataAdapter.insertcommand.parameters.add("parameter1", sqldbtype.int , 6 , "ColumnName")
You'll need to add a parameter for each item your inserting. sqldbtype.int is the data type change to whatever you need. 6 is the field length.

TPM
 
Top Bottom