Tuesday, May 5, 2009

I Need to connect to MS Sql server using Vb 6.0

Hello everybody!
i am having problem to connect to MSSQL Server 2000 using vb 6.0.....
is there anybody who can help me in this regard????

5 comments:

  1. Can you please send me the full text of the error generated?

    ReplyDelete
  2. i am also having the same problem, waiting anxiously to get the right solution... you help will highly be appreciated...

    ReplyDelete
  3. OK the simplest way to connect through vb to mssql server is that
    Step 1. declare a variable of type connection as

    dim con as new adodb.connection

    step 2. now make the connection string to be passed to this connection variable.
    like below

    con.open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=master;Data Source=(local)"

    so this is how to connect to mssql server through vb.

    i think it will get your work done.

    ReplyDelete
  4. Sorry one thing more i want to add.
    i have used database name as "master" so you can use your own and also i have given "(local)" as my database server so you can just replace this with the system name or ip of your database server.

    ReplyDelete
  5. gr8. it worked for me and i think it is a very easy way to connect to database.
    thanks imtiaz.

    ReplyDelete