Solved

Insert data into Access database from VB 2005 form

Posted on 2007-12-01
2
5,095 Views
Last Modified: 2013-11-26
I have a Visual Basic form where data is entered.  I need to insert this data into an Access database but I don't know the code.  I am a newbie at this.
0
Comment
Question by:MyTime2Live
2 Comments
 
LVL 2

Accepted Solution

by:
telefonia earned 500 total points
ID: 20390344
   '''''''############## Example code
        Dim oled1 As System.Data.OleDb.OleDbConnection
        Dim dir As String = System.Environment.CurrentDirectory & "\mybase.mdb"
       oled1 = New  System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dir & ";Persist Security Info=True")
Dim insert as string = "Insert Into table(col1,col2)values('" & texthere1 & "', '" & texthere2 & "')"
Dim insertcomand as new  System.Data.OleDb.Oledbcommand(insert, oled1)
oled1.open()
insertarcommand.executenowquery()
oled1.close()


       
0
 

Author Closing Comment

by:MyTime2Live
ID: 31412167
When I said I was a newbie I really meant a newbie so I had to work some to understand this answer.  It was accurate but a little above my level.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question