PC Review


Reply
Thread Tools Rate Thread

Connecting between VB.Net 2005 and MS ACCESS 2003

 
 
jtnpham@gmail.com
Guest
Posts: n/a
 
      19th Feb 2007
My question has to do with the connection between these two. Right
now on the userform I have textboxes for the user to input values.

What I want to do is to have buttons with the names of ADD Record,
MODIFY Record, and DELETE Record.


I don't know how to connect with the database in MS ACCESS and edit
it
accordingly with the textboxes. I know how to do it using a
DataGridView, though.


I've done research and saw SQL statements for each button action, but
when I enter that in my boilerplate nothing happens.


For EXAMPLE:


Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
City = txtCity.Text
Country = txtCountry.Text
p2005 = txt2005.Text
p2015 = txt2015.Text


Dim dt As New DataTable()
Dim connStr As String = "Proficer = Microsoft.Jet.oledb.4.0;"
& "Data Source=F:\Pham\megacities.mdb"
Dim sqlStr As String = "INSERT INTO Cities VALUES(city,
country, p2005, p2015)"
'Would it be okay to have this as my SQL string?:
'"INSERT INTO Cities VALUES(txtCity.text, txtCountry.text,
txt2005.text, txt2015.text)"
Dim dataadapter As New OleDb.OleDbDataAdapter(sqlStr,
connStr)
dataadapter.Fill(dt)
dataadapter.Dispose()


Can anyone help? Or have suggestions?


Thanks! =)

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting to SQL Server 2005 with Access 2007 Brian Microsoft Access Form Coding 0 25th Jun 2008 02:34 PM
2950 error - Access 2007 ADP connecting to SQL 2005 =?Utf-8?B?SXNod2FyIEF3YWxnYW9ua2Fy?= Microsoft Access ADP SQL Server 5 8th Sep 2007 09:00 AM
Access 2003 Project connecting to SQL 2005 =?Utf-8?B?RmluY2FzdGxl?= Microsoft Access ADP SQL Server 2 7th May 2007 11:56 PM
Re: Access 2003 Project connecting to SQL 2005 Susie DBA [MSFT] Microsoft Access ADP SQL Server 0 24th Apr 2007 09:07 PM
Connecting Access 2003 to SQL Server 2005 Express =?Utf-8?B?am9lQjU0NQ==?= Microsoft Access 4 30th Oct 2006 04:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:10 PM.