Looking for ADO statement for SQL Database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • news.verizon.net

    Looking for ADO statement for SQL Database

    I have a database in SQL2K and I want to write a small program in VB6.

    Once I create program in VB6, it should work from any client's computer.

    My SQL database is sitting on share drive X on the w2k server. My sql2k
    server name is MYSERVER, my database name is MYDATABASE and table name is
    MYTABLE.

    I do not want to set up ODBC connection on each computer. I want to set up
    in the program so I do not have to go thru each computer each time I write
    any program.

    Thanks.


  • Steve Gerrard

    #2
    Re: Looking for ADO statement for SQL Database


    "news.verizon.n et" <max@hotmail.co m> wrote in message
    news:ipNyb.1135 8$n4.3745@nwrdd c01.gnilink.net ...[color=blue]
    > I have a database in SQL2K and I want to write a small program in VB6.
    >
    > Once I create program in VB6, it should work from any client's[/color]
    computer.[color=blue]
    >
    > My SQL database is sitting on share drive X on the w2k server. My[/color]
    sql2k[color=blue]
    > server name is MYSERVER, my database name is MYDATABASE and table name[/color]
    is[color=blue]
    > MYTABLE.
    >
    > I do not want to set up ODBC connection on each computer. I want to[/color]
    set up[color=blue]
    > in the program so I do not have to go thru each computer each time I[/color]
    write[color=blue]
    > any program.
    >
    > Thanks.
    >
    >[/color]
    Use ADO (Add a Reference to Microsoft ActiveX DataObjects).

    The code will look vaguely like this. You will need to lookup the
    various methods, check the parameters, and get the values right for your
    particular setup.

    Dim oConn as Connection
    Dim oRecSet as Recordset

    Set oConn = New Connection
    Call oConn.Open ( "Provider=SQLOL EDB.1;Initial Catalog=mydatab ase;Data
    Source=MyServer ", UserName, PW)

    set oRecSet = New Recordset

    call oRecSet.Open("S ELECT RecID From tblSample", oConn, adOpenStatic,
    adLockOptimisti c)

    You can use the Microsoft ADO Data Control to setup your first
    connection, and get the connection string from it, although I would not
    use the control itself in an application.

    Hope this helps.

    Steve


    Comment

    • Bob Butler

      #3
      Re: Looking for ADO statement for SQL Database

      "news.verizon.n et" <max@hotmail.co m> wrote in message news:<ipNyb.113 58$n4.3745@nwrd dc01.gnilink.ne t>...[color=blue]
      > I have a database in SQL2K and I want to write a small program in VB6.
      >
      > Once I create program in VB6, it should work from any client's computer.
      >
      > My SQL database is sitting on share drive X on the w2k server. My sql2k
      > server name is MYSERVER, my database name is MYDATABASE and table name is
      > MYTABLE.
      >
      > I do not want to set up ODBC connection on each computer. I want to set up
      > in the program so I do not have to go thru each computer each time I write
      > any program.[/color]

      create a UDL file and distribute that with your app and open your
      connection using: connection.Open "file name=pathtotheu ldfile;"

      or just embed the connection string in your app
      connection.open "Provider=SQLOL EDB.1;Data Source=MyServer ...."

      Comment

      Working...