User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Visual Basic and ODBC / Access Page [1]  
aaronburro
Sup, B
53068 Posts
user info
edit post

I'm a total n00b to VB, though I don't think it'll be too hard to learn. What I'm wondering about, though, is how I will connect to an ODBC database for read access with it. I'm probably also going to need to connect to an Access db for read and write access, which I am also spectacularly n00bish on. I am creating/administering the Access db right now, but I'd like to write a VB front end so that I don't have to install Access on every machine in the office.

Basically, I'm hoping someone here can point me to some good resources, free or otherwise, that will help me learn what I need to learn or at least serve as a good reference or starting point for my questions. I'll be working w/ VB 6.0, btw.

Thx in advance

5/24/2006 5:01:59 PM

Novicane
All American
15416 Posts
user info
edit post

Sendkeys ALT+F4

5/24/2006 5:14:50 PM

Perlith
All American
7620 Posts
user info
edit post

Quote :
"I am creating/administering the Access db right now"


Make sure your database is solid before you write a front-end for it.

I have one book I use for reference ... not sure how it would fair for learning VB:
http://www.amazon.com/gp/product/1884133932/

5/24/2006 6:24:24 PM

LimpyNuts
All American
16859 Posts
user info
edit post

Use ActiveX Data Objects (ADODB). Really easy. Pretty much what you need is an:

ADODB.Connection - an object that manages your database connection
ADODB.Recordset - your query results


Dim Conn as ADODB.Recordset
Dim Rset as ADODB.Recordset

Set Conn = New ADODB.Recordset
Conn.Open 'use appropriate conection string and such
Set Rset = Conn.Execute("SQL QUERY HERE")

Rset.MoveFirst
While Not Rset.EOF
'do something with your record
Rset.MoveNext
Wend

Conn.Close
Set Conn = Nothing
Set Rset = Nothing



You can leave the database connection open and run all the queries you want with it. Just remember to close it and set it to Nothing to free memory wen you're done with it. Depending on how you conect to the datbase, you may or may not be able to determine how many records are in the resulting recordset without looping through and counting.

[Edited on May 24, 2006 at 9:31 PM. Reason : ]

5/24/2006 9:29:08 PM

scud
All American
10804 Posts
user info
edit post

1.) Get VisualStudio 2005 Express C#
2.) Forget about VB6
3.) Pick up a ADO.NET book
4.) Migrate database to a real RDMBS
5.) ...
6.) Profit

5/25/2006 8:47:22 AM

 Message Boards » Tech Talk » Visual Basic and ODBC / Access Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.