I'm working on a WebApplication for my school that will allow Students and Faculty to add events, respond tom, edit, etc.. But right now I'm just working on a standalone VB app to start with. I have a database and can read from it fine. Although when I try to insert into it, itgives me an error:
"A unhandled exception of type 'System.NullReferenceException' occured in DataBaseReadWrite.exe"
Additional information: Object reference not set to an instance of an object."
and it highlights my whole insert statement....
Take a look at it and see what you think:
DA.InsertCommand.CommandText = _
"INSERT INTO EventData (Name, " & _
"UserID, Event Time, Cost, tStamp)" & _
"VALUES('" & txtName.Text & "', " & _
"'" & txtUID.Text & "' , " & _
"'" & txtEvent.Text & "' , " & _
"'" & pckDateTime.Text "' , " & _
"'" & txtCost.text "' , " & _
"'" & Now.ToLongTimeString() & "')"
At first i was using it with SelectCommand.CommandText, and it worked when i inserted 3 values, and then i tried to add all of them int he SelectCommand and it gave me a syntax error in my INSERT INTO statement. Then i realized there was an InsertCommand (I'm very n00b at .net!) and I switched it , and now nothing works!
Any help will be greatly appreciated!
Thanks