Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 15th, 2007, 11:23 PM
Registered User
Join Date: Jul 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to yzlin04 Send a message via Yahoo to yzlin04
Default Problem with inserting a new row in MS Access

I'm new in vb.net. I have a problem in inserting a new row to a MS Access database table.
There is no error message comes out when i run my program, but when i check my MS Access table,
there is no record inserted. So, i don't know which line is incorrect.

Here is my code:

        Dim desc, itemID As String

        itemID = txtItemID.Text
        desc = txtItemDesc.Text

        Dim myOleDbConnection As OleDb.OleDbConnection
        Dim insertCommand As String
        Dim myConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\Lecture\CS220\Program backup 3\Ai Ling Ka Salon System\database\login.mdb;User

        insertCommand = "INSERT INTO tblLogin (username, password) VALUES(desc, itemID);"

        myOleDbConnection = New OleDb.OleDbConnection(myConnectionString)

        Dim myOleDbCommand As New OleDb.OleDbCommand(insertCommand, myOleDbConnection)

        myOleDbCommand = myOleDbConnection.CreateCommand

        myOleDbCommand.CommandType = CommandType.Text

        myOleDbCommand.CommandText = insertCommand


        Dim temp_num As Integer
            temp_num = myOleDbCommand.ExecuteNonQuery
        Catch ex As Exception

        End Try


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in inserting a new row in MS Access yzlin04 VB.NET 2002/2003 Basics 2 July 18th, 2007 11:11 PM
having problem in inserting in access database alto ASP.NET 2.0 Basics 4 May 24th, 2007 08:57 PM
problem with inserting images in Access report pankaj_daga Access 1 February 1st, 2007 08:45 AM
Insert row into MS-ACCESS database ITladybug ADO.NET 1 January 28th, 2006 07:57 AM
Problem with inserting data into an Access DB donrafeal ASP.NET 2.0 Basics 0 January 6th, 2006 05:34 PM

All times are GMT -4. The time now is 01:41 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.