|
-
Feb 15th, 2003, 10:20 AM
#1
Thread Starter
Junior Member
delete records? any ideas?
why dont this work?
Public Sub SaveRecords(ByVal Values As DataSet)
Const conSQLConnectionString As String = "Trusted_Connection=False;Server=LUSQL01;uid=dfg;pwd=dsfgdf;database=vcxx"
Dim con As New System.Data.SqlClient.SqlConnection(conSQLConnectionString)
con.Open()
'create dataadapter
Dim da = New System.Data.SqlClient.SqlDataAdapter("select * from bok where isbnnr = 'isbn'", con)
ds = Values
'Fill the Dataset
da.Update(ds)
con.Close()
End Sub
gets this error:
An unhandled exception of type 'System.InvalidOperationException' occurred in microsoft.visualbasic.dll
Additional information: Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
-
Feb 15th, 2003, 04:16 PM
#2
PowerPoster
Dim da = New System.Data.SqlClient.SqlDataAdapter("select * from bok where isbnnr = 'isbn'", con)
ds = Values
'Fill the Dataset
da.Update(ds)
Your data adapter is performing a select statement, and your calling for an update, it doesn't know what your trying to do (update, or select).
-
Feb 16th, 2003, 06:21 AM
#3
Thread Starter
Junior Member
Yonk..
Ok, I see.. but how do I fix it, Ive played around with it for a while and I got no clue at all... should I use sqlcommand in any way or what?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|