Visual Basic and Access
Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Visual Basic and Access

  1. #1
    Now, RFC Compliant! Noia's Avatar
    Join Date
    Jan 2002
    Posts
    1,210

    Visual Basic and Access

    I'm working on a school project in VB, and quite frankly, the teacher sucks...not teaching us what we need. My project involves using an Access Database and executing SQL statements on it and showing/inputing data etc. My problem isn't SQL, it's how to connect to the damn database....I'v googled it to death, and I'v not found any useful source or walk through, aswell as the books I have are useless. Soo....I turn to AO; any one here willing to show me how to create a connection to a database and how to open/close it and hopefully how to execute SQL on it if they have time.

    Bleh....I need to go tell me teacher off for being useless!

    - Noia
    With all the subtlety of an artillery barrage / Follow blindly, for the true path is sketchy at best. .:Bring OS X to x86!:.
    Og ingen kan minnast dei linne drag i dronningas andlet den fagre dag Då landet her kvilte i heilag fred og alle hadde kjærleik å elske med.

  2. #2
    Ninja Code Monkey
    Join Date
    Nov 2001
    Location
    Washington State
    Posts
    1,027
    Using ADO to work with Access databases at msdn - http://msdn.microsoft.com/library/de...sdatabases.asp
    "When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
    "There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
    "Mischief my ass, you are an unethical moron." - chsh
    Blog of X

  3. #3
    Now, RFC Compliant! Noia's Avatar
    Join Date
    Jan 2002
    Posts
    1,210
    hmmm...it worked...and then it was as if it was /.'d DNS failure. Still, didn't contain alof of Syntax as far as I could see, but I didn't get to read it all either.
    With all the subtlety of an artillery barrage / Follow blindly, for the true path is sketchy at best. .:Bring OS X to x86!:.
    Og ingen kan minnast dei linne drag i dronningas andlet den fagre dag Då landet her kvilte i heilag fred og alle hadde kjærleik å elske med.

  4. #4
    Ninja Code Monkey
    Join Date
    Nov 2001
    Location
    Washington State
    Posts
    1,027
    They tell you further into that section how to make a connection to a jet database via ado, and then even further down how to work with it. You need to do the research to understand how it all works.
    "When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
    "There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
    "Mischief my ass, you are an unethical moron." - chsh
    Blog of X

  5. #5
    Now, RFC Compliant! Noia's Avatar
    Join Date
    Jan 2002
    Posts
    1,210
    Hmm, yea...Just these books and tuts I'v read are all messed up....I'm really confused now :s
    With all the subtlety of an artillery barrage / Follow blindly, for the true path is sketchy at best. .:Bring OS X to x86!:.
    Og ingen kan minnast dei linne drag i dronningas andlet den fagre dag Då landet her kvilte i heilag fred og alle hadde kjærleik å elske med.

  6. #6
    Junior Member
    Join Date
    Oct 2001
    Posts
    16
    Are we talking VB6 or VB.Net?

  7. #7
    Senior Member MadBeaver's Avatar
    Join Date
    Jul 2003
    Location
    Bath, Maine
    Posts
    252
    Mad Beaver

  8. #8
    Now, RFC Compliant! Noia's Avatar
    Join Date
    Jan 2002
    Posts
    1,210
    VB6, sorry, should have mentioned.
    With all the subtlety of an artillery barrage / Follow blindly, for the true path is sketchy at best. .:Bring OS X to x86!:.
    Og ingen kan minnast dei linne drag i dronningas andlet den fagre dag Då landet her kvilte i heilag fred og alle hadde kjærleik å elske med.

  9. #9
    Junior Member
    Join Date
    Oct 2001
    Posts
    16
    This will get you a connection to your database.

    dim cnn as adodb.connection
    With cnn
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .Properties("Jet OLEDB:System Database") = c:\mymdw.mdw
    .Properties("Jet OLEDBatabase Locking Mode") = adLockOptimistic 'row-level locking
    .Properties("User ID") = "User"
    .Properties("Password") = "Password"
    .Open c:\mydb.mdb
    .Properties("Jet OLEDB:Lock Retry") = 5
    End With

    'With the connection you can then create recordsets.
    Dim rst as recordset
    Set rst = New Recordset

    rst.Open "Select * from MyTable", cnn, adOpenForwardOnly, adLockReadOnly
    ' Then loop through the recordset

  10. #10
    I like VB, and I'm not to good with Databases, but good enough.
    www.vbexplorer.com (forums and tuts)
    www.planetsourcecode.com (ultimate for code examples)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •