Problems updating a dataset

newbjohny

Member
Joined
Jul 10, 2006
Messages
11
Programming Experience
Beginner
Hi, I am having trouble in updating my dataset, I create a dataset from a select command and display the details to a datagrid. I then goto the next new line in the datagrid and insert some new details then click the insertRow button (code below) and I get the following error message :-

the exception which is caught states : - "Value cannot be null. Parameter name: dataset"

I am not up to scratch with datasets, but all examples I can find of updates are where only one line of the dataset is shown at a time in text boxes and then a blank set of textboxes are displayed to add a new row then convert the textboxes.text to the add row command, but I am creating an application to be a front end to a database so none of the columns are known so I cannot create this form of input as the amount of textboxes would never be known.

Please help

Many thanks

John

Code for updating dataset

VB.NET:
    Private Sub btnInsertRow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsertRow.Click
        Dim dset As DataSet
        tblName = (cmbInsertData.Text)
        dbConn.openExistingDatabse("Data Source=" & getDBName() & ";Version=3;New=False;Compress=True;")
        dbConn.createSQLCommand()
        Try
            dbConn.updateDataSet(dset, tblName)
        Catch es As Exception
            MessageBox.Show(es.Message)
        End Try
    End Sub

VB.NET:
    Public Sub updateDataSet(ByVal dset As DataSet, ByVal tableName As String)
        Dim sqlite_dataAdapter As SQLiteDataAdapter = New SQLiteDataAdapter()
        sqlite_commandBuilder = New SQLiteCommandBuilder(sqlite_dataAdapter)
        sqlite_dataAdapter.Update(dset, tableName)
    End Sub
 
I have since tried that and also added in the following line :-
dset = StoreDataSet.getDataSet
which now brings me a different error as follows:-
Improper SQLiteCommandBuilder state: adapter's SelectCommand is null.
 
Back
Top