hi, I have two sql strings being executed at the same time one of which is an update statement and the other a save statement. The save statement works but the update statement does not.
Here is the error i am receiving

System.NullReferenceException: Object reference not set to an instance of an object.
   at Albergo.frmCheckIn.saveToDB() in C:\Users\gman\Documents\Visual Studio 2008\Projects\Albergo\Albergo\frmCheckIn.vb:line 98

the code i am using is the one below:

Try
    Using dachk As New OleDb.OleDbDataAdapter(sql2, con)
                        connectDatabase()
                        'updating the roomstatus column in the rooms table
                        dachk.UpdateCommand.ExecuteNonQuery()
                        '////ends here
                        DisconnectDB()
                        dachk.Update(dsChk)
    End Using
Catch ex As Exception
            MessageBox.Show(ex.ToString)
            Clipboard.SetText(ex.ToString)
End Try

i will be greatful for any help

i have replaced the oledb.oledbadapter with oledb.oledbcommand and its working. I still don't understand why but it's working. I guess that's code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.