Results 1 to 5 of 5

Thread: Connecting to SQL Server 6.5/7 from VB3-Land

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Southbridge, MA, USA
    Posts
    40
    My project requires that I load a recordset from a SQL Server 6.5/7 database into a grid in a VB3 app.

    I can do this like a charm with VB6 ADO, but... The VB3 ODBC 16-bit drivers cannot connect to SQL. Is there a way to get the 32-bit driver recognized by VB3?

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    As I recall (and it was a long, long time ago) you cound use WIN32S. However, I don't even know if you can get it any more... Why are you committed to VB3?

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Southbridge, MA, USA
    Posts
    40
    Sadly, it is a legacy product that will never, for reasons too numerous to mention, be upgraded beyond VB3.

  4. #4
    New Member
    Join Date
    Apr 2017
    Posts
    2

    Re: Connecting to SQL Server 6.5/7 from VB3-Land

    Quote Originally Posted by cfmoxey View Post
    My project requires that I load a recordset from a SQL Server 6.5/7 database into a grid in a VB3 app.

    I can do this like a charm with VB6 ADO, but... The VB3 ODBC 16-bit drivers cannot connect to SQL. Is there a way to get the 32-bit driver recognized by VB3?
    I know it's a bit late and you've moved on but this may help other people who are similarly stuck in the past.

    If you look in the VB3 Help under the OPENDATABASE function you will see that you can connect to a SQL server database using ODBC.

    You can even connect to a 64-bit SQL Server 2016 database using this method along with any other ODBC compliant database.
    While the other advice to move the program to an updated language is the obvious answer - it is possible to work with VB3 and SQL server.

    You can't use ADO with VB3 however but you are stuck with DAO.

    I am in a similar position with a number of customers using applications written in VB3 and using ms-access V2 which I'd like to migrate to SQL server.
    I'm choosing to update the programming language mostly because 16-bit apps won't run on 64-bit Windows.
    However the VB3 apps DO run quite OK on windows 7/8/87/1/10 32-bit versions with no tricky workarounds required.

    If the apps are not that large it shouldn't be too hard to migrate them to VB6 and use SQL server but I have VB3 apps with around 1,000,000 lines of code which pushes them to their absolute memory limit but they still work. tried to convert these to VB6 using my own VB6 conversion wizard on servral occassion but given up because the number of errors that you need to fix before the program will even run at all is so large.
    Unfortunately you only find out about these errors one at a time using run, identify next error, fix error, run, identify next error, fix error, run and so on.

    I have a number of customers running these VB3 apps on 64-bit Windows (even in 2017) by using a VirtualBox or VMWare virtual machine running a 32-bit version of the same Version of Windows as the host machine.
    In some cases they've even been able to use the same product key for both the virtual and physical machine - which may not be totally kosher but since there is only one computer and one user involved I doubt that Microsoft would be too concerned.

    anyway - to get access to a SQL server database from VB3 ...

    Create an ODBC entry called MyDatabase which points to a SQL server database then run this code (or similar) in your VB3 application.

    You can see that you CAN access a SQL server database from VB3 - not only that but the database I accessed was running in a 64-bit SQL server instance on a 64-bit windows 10 PC

    Sub Main ()

    Dim dBase As Database, rsWork As Dynaset, Cnt As Integer

    Set dBase = OpenDatabase("MyDatabase", False, False, "ODBC; DSN=MyDatabase;UID=username; PWD=password")
    Set rsWork = dBase.CreateDynaset("Select * from customers")
    rsWork.MoveFirst
    For Cnt = 1 To 10
    MsgBox CStr(Cnt) & ":" & rsWork("Name")
    rsWork.MoveNext
    Next Cnt
    rsWork.Close
    dBase.Close
    End
    End Sub

  5. #5
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Connecting to SQL Server 6.5/7 from VB3-Land

    Not that it helps, but this all reminds me of a project I worked on a long time ago. I had to build a library that allowed our VB3 apps (this was circa 1995) to talk to the new SQL Server (6 I think it was) ... which was on shiny brand new 32-bit boxes... VB3 still was 16-bit so it couldn't talk to SQL Server directly. I ended up building a library that sat on top of the ODBC API that acted as a bridge between all our VB3 apps and SQL Server... talk about getting down and dirty in the weeds. Ended up calling the library SQurL - SQL Query Library - pronounce Squirrel ... probably because of how I felt about it at the time.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width