473,396 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Database INSERT statement

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.AppSet tings("strConnection"))
Dim strSQL As String = "INSERT INTO tblDL (DLNumber, DateAdded) VALUES
('" & strDL & "', " & Now & ");"

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

End Sub

Nov 19 '05 #1
3 1092
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.

"Sparky Arbuckle" <tw*@secureroot.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
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.AppSet tings("strConnection"))
Dim strSQL As String = "INSERT INTO tblDL (DLNumber, DateAdded) VALUES
('" & strDL & "', " & Now & ");"

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

End Sub

Nov 19 '05 #2
LOL! I shouldn't have drank last night!

Nov 19 '05 #3
Pat
Drinking is good but at the right time..
And the funniest thing is that i see more of .Net when drink:)

"Sparky Arbuckle" <tw*@secureroot.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
LOL! I shouldn't have drank last night!

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Sans Spam | last post by:
Greetings! I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE,...
6
by: Clay Beatty | last post by:
When you create database diagrams in Enterprise Manager, the details for constructing those diagrams is saved into the dtproperties table. This table includes an image field which contains most of...
2
by: Kums | last post by:
What is the maximum permissible size of a database? Is there any limitation. What is the maximum # of tablespace's allowed in a database? Thanks for your response.
1
by: Azel | last post by:
Hi, I am trying to learn ADO.net and I keep running into problems trying to insert data into my Access Database: data.mdb. here is my code: <code> // Database Variables
1
by: blu3g85 | last post by:
in my database, i have friendA details, friendB details, friendC details etc. how do u add a friendA to the user database and then show the name of friendA in "user details" page and when the user...
0
by: M. David Johnson | last post by:
I cannot get my OleDbDataAdapter to update my database table from my local dataset table. The Knowledge Base doesn't seem to help - see item 10 below. I have a Microsoft Access 2000 database...
7
by: Cindy H | last post by:
Hi I'm having a problem getting the insert statement correct for an Access table I'm using. The Access table uses an autonumber for the primary key. I have tried this: INSERT INTO Tournaments...
10
by: shsandeep | last post by:
The ETL application loaded around 3000 rows in 14 seconds in a Development database while it took 2 hours to load in a UAT database. UAT db is partitioned. Dev db is not partitioned. the...
22
Frinavale
by: Frinavale | last post by:
How To Use A Database In Your Program Many .NET solutions are database driven and so many of us often wonder how to access the database. To help you understand the answer to this question I've...
1
Curtis Rutland
by: Curtis Rutland | last post by:
How To Use A Database In Your Program Part II This article is intended to extend Frinny’s excellent article: How to Use a Database in Your Program. Frinny’s article defines the basic concepts...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.