Jump to content

Dsn Connection Vb 6.0

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
nishbur

nishbur

    Newbie

  • Members
  • Pip
  • 9 posts
hi guys.i've trying to use dsn less connection in vb 6.0

what i want to do is to declare the code in a module
instead on the form load
but i don't the correct syntax

i've started like this
###############################
public db1 as  ADODB.Connection
public rs1 as  ADODB.Recordset

#################################
i want the path also to be declared in the module

db1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\DSN Less Conn sample\library.mdb"




################################################################

on form load
********************
Set db1 = New ADODB.Connection
'open database
db1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\DSN Less Conn sample\library.mdb"

Set rs1 = New ADODB.Recordset
'open table
rs1.Open "SELECT * FROM book", db1, adOpenKeyset, adLockPessimistic
#################################################

can anybody tell me where can i get a tutorial on how to use sql
waht i mean by that is the different syntax like "select from, Insert into" in vb 6.0

Edited by TcM, 29 March 2008 - 05:28 AM.
CODE TAGS!!!!!!!


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Moved to correct forum.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
What do you mean? You can just create a new module, create a function, paste your code there and call the function name from the form load event or whatever.

#4
nishbur

nishbur

    Newbie

  • Members
  • Pip
  • 9 posts
that 's what i don't know how to create that function

i've copyied that code in the module but i've got an error

db1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\DSN Less Conn sample\library.mdb"