0

when trying to update a sql database i get the following error message on Update

Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information

the column UserID is the PrimaryKey

any ideas would be appreciated

Thanks
Peter


example code:

Private dt as new datatable
private dv as new dataview

Public sub GetData
    dim da as new SqlDataAdapter("SELECT * FROM tblUser", sqlconn.connectionstring)
    da.fill(dt)
    dt.TableName = "tblUser

    dv.table = dt
    dgUserData.datasource = dv
end sub

private sub setdata()
    Dim Row As DataRow
    Row = dv.Item(dgUserData.CurrentRow.Index).Row

    Row("username") = txtUsername.text
end sub

private sub SaveDataToServer()
    dim da as new SqlDataAdapter("SELECT * FROM tblUser", sqlconn.connectionstring)

da.update(dt)

end sub
2
Contributors
2
Replies
7
Views
10 Years
Discussion Span
Last Post by chan_lemo
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.