Database INSERT statement

S

Sparky Arbuckle

I can't for the life of me figure out why this won't insert into my
database. I'm also not getting any errors when I run this. I've even
tried inside a TRY CATCH block and still nothing. I've run this web app
numerous times and each time I check the database, nothing is there! I
must be missing something small here.

Private Sub btnSubmitDLNumber_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnSubmitDLNumber.Click

Dim strDL As String = tbDL.Text

Dim objConn As New
OleDb.OleDbConnection(ConfigurationSettings.AppSettings("strConnection"))
Dim strSQL As String = "INSERT INTO tblDL (DLNumber, DateAdded) VALUES
('" & strDL & "', " & Now & ");"

Dim objCommand As New OleDb.OleDbCommand(strSQL, objConn)

End Sub
 
M

Marina

You are never actually executing the query. All you do is create an
OleDbCommand object with the query text. But that's it.

You need to open the connection, run the query, then close the connection.
 
P

Pat

Drinking is good but at the right time..
And the funniest thing is that i see more of .Net when drink:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top