Current location: Hot Scripts Forums » Programming Languages » Windows .NET Programming » Vb.Net Connections


Vb.Net Connections

Reply
  #1 (permalink)  
Old 05-05-04, 04:29 AM
reinier reinier is offline
New Member
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Vb.Net Connections

Hi

I'm new to vb.net but have coded in VB6 for a few years.
My question is:
How do I connect to and query a access 2000 database ? I saw in the book that I have that you have to put object like the sqldataadapter on the screen. Is this the same as the dataconnection obkect that was in VB ? I usually coded my connection strings and all that and defined the record sets in code.
What is the correct way to do this in vb.Net ? Please help!!

Regards Reinier
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-05-04, 11:43 AM
kasic's Avatar
kasic kasic is offline
Newbie Coder
 
Join Date: Apr 2004
Location: Serbia
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
I think this code should do the work

Imports System.Data.OLEDB
Imports System.Data

Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=ure_db.mdb;"
Dim strSQL As String = "SELECT * FROM some_table;"
Dim conn As New OLEDB.OLEDBConnection(strConn)
conn.Open()

Dim cmd As New OLEDB.OLEDBCommand(strSQL,conn)
Dim DataR As OLEDB.OLEDBDataReader = cmd.ExecuteReader()

While (DataR.Read())
DataR.Item("field_from_some_table")
End While

this should work...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VB.NET - Show another form? Tesco Windows .NET Programming 11 06-04-04 08:09 AM
load and unload forms in VB.Net warpminded Windows .NET Programming 3 03-16-04 12:07 PM
HTTP wrapper does not support writeable connections b3groove PHP 2 03-09-04 06:00 PM
Still too many MySql connections CoraxCornerman PHP 1 02-08-04 10:51 PM
VB 6.0 vs. VB.NET Dj_Farout Windows .NET Programming 0 01-08-04 06:46 PM


All times are GMT -5. The time now is 09:09 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.