VB 6.0 and SQL Server 2000 connection problem

  • Hi,

    I am new to Database programming. Recently with respect to our project we wanted to link you all our databases in SQL server 2000 using VB, but we could not do it. So we are first linking all the tables into MS Access and from there linking them to VB.

    I am assuming there is a better way which I am missing. Any help will be greatly appreciated.

    thank you,

    Vijay

  • VB doesnt support the concept of linking. If you're already using Access it may make sense to link the tables there just to keep it all in once place. You can access anything in SQL directly by opening an ADO connection and then using it (or a command object) to execute code, return recordsets, etc. I've got several articles here on the site about how to use ADO and MS has a ton of stuff at http://www.msdn.microsoft.com.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • HI,

    the basic operation to access to SQLServer 2000 with vb is to use ADO.

    In your project reference Microsoft Activex Data Object 2.6 or upper.

    In you project type something like this.

    To open the connection:

    dim cn as adodb.connection

    set cn = new adodb.connection

    cn.open "File Name=c:\conn.udl"

    to retrieve some data write this

    dim rs as adodb.recordset

    set rs = new adodb.recordset

    rs.open "select * from table",cn, ..., ...

    these are the minimal instructions to retrieve data from sqlserver database.

    Bye Antonio

  • Thanks a lot guys for your valuable suggestions. It helps a lot. I will play around and see how things goes ( and will bug you all if I get some serious problems).

    thank you,

    Vijay

  • hi Vijay

    if you want some suggestions please contact me!

    bye antonio

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply