Results 1 to 3 of 3

Thread: delete records? any ideas?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2001
    Posts
    30

    Question 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.

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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).

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2001
    Posts
    30

    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
  •  



Click Here to Expand Forum to Full Width