Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Vb to database

  • 19-02-2003 3:40pm
    #1
    Registered Users, Registered Users 2 Posts: 4,276 ✭✭✭


    I'm having problems setting up a connection with visual basic and a databse.

    I've found lots of sites saying go here and do this and that, or else the code for a conection. But I'm unsure to what type I should actually be makeing.

    Does it matter if I use a ole, ado or whatever connection is available ?

    Once I have decided and I make my code what do I go about doing ?

    Do I create teh connection type as one variable, the SQL command as another ? How do I go by putting these all together so I can connect to the db ?

    What about connecting to a db on a different machine over ip or a lan?

    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    No offence, but how about you read any book, manual, or helpfile which discusses VB to database connections, and they will give you everything you need....code included.

    If you cant get that to work, come back and ask a real question.


    jc


  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    Originally posted by damnyanks
    Does it matter if I use a ole, ado or whatever connection is available?
    Yes, but not in a simple "X is bad, Y is good". I'd recommend you start with ADO, but learn more than one way (always learn more than one way of doing anything if you can, it stops you making assumptions).
    What about connecting to a db on a different machine over ip or a lan?
    That will be pretty much invisible, and a concern of the library or component you use (just give it the server name or IP, or put that in a DSN). Apart from concerns about timing there is no difference at the level of the VB code whether the server is on the same box or not.


  • Registered Users, Registered Users 2 Posts: 4,276 ✭✭✭damnyanks


    Originally posted by bonkey
    No offence, but how about you read any book, manual, or helpfile which discusses VB to database connections, and they will give you everything you need....code included.

    If you cant get that to work, come back and ask a real question.


    jc

    I have thats why I'm asking here. I havent found a book or anything that is clear in the way you should go by doing it.

    They all assume you want to build some big application that will run searchs, entry , deleter and modify options.

    All I want to see is how to connect to a db and call something properly without including alod of useless code.

    So no offence but if you have remarks with no helpful info at all its best you don't say it, and yes I did google it. Found lots of stuff about using built in functions which my version of vb didnt seem to have.

    Thanks Talliesin


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    What version of vb are you using? Personally I'd set up the connection in a DSN as Talliesin said and then connect through ADO but try different ways. Set up a DSN in Control Panel/ODBC Data Sources for Win98. Where the ODBC Manager is in XP and Win2000 escapes me at the moment.

    Can we see your code with any errors it produced?
    Do I create teh connection type as one variable, the SQL command as another ?

    Yeah, you could instanciate (spl?) a connection object and use that to excecute your SQL but there's more than one way to skin a cat. Play around and find out which way you prefer - ´tis fun.


  • Registered Users, Registered Users 2 Posts: 1,931 ✭✭✭Zab


    Originally posted by Evil Phil
    Where the ODBC Manager is in XP and Win2000 escapes me at the moment.

    It's under Administrative tools in Control Panel.

    Zab.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    A-ha!

    thanks Zab.


  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    Originally posted by damnyanks
    I have thats why I'm asking here. I havent found a book or anything that is clear in the way you should go by doing it.

    They all assume you want to build some big application that will run searchs, entry , deleter and modify options.

    Em. What else are you going to do with a database?


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    Originally posted by damnyanks
    Found lots of stuff about using built in functions which my version of vb didnt seem to have.
    Thats most likely because you havent set the references to whatever connection technology you choose to use (DAO, RDO, ADO, whatever).

    The functions aren't built in.

    You'll find what you're looking for under tools/references I believe.

    If you still dont find what you're looking for, then its probably cause it isnt installed. Go to the MS site and look for the latest download of MDAC, which is the full (I think) Data Access package which will have anything youre missing.

    Data Access isnt built in to VB - its bolted on - just like almost everything else.

    jc
    jc


Advertisement