#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    1
    Rep Power
    0

    Question VB3 and SQL Server


    Does anyone know if it is possible for an application written in VB3 to work with SQL Server?

    I have an VB3 application which utilizes DAO to read and write to and from an Access 2 database, and it uses bound controls... I am being asked if I can replace the Access 2 database with an SQL Server database and modify the VB3 application so that it now reads and writes to and from the SQL Server database!!

    Does anyone know if this is even possible? Or recommended?!

    Along the same lines, does anyone know if it's possible to use ADO with VB3?

    Thanks in advance for any assistance provided...

    Dan L.
  2. #2
  3. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    247
    I am glad I don't have your job!

    I suggest attempting to port the VB app to VB 6 or .Net if you have the resources available.

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2016
    Location
    Adelaide
    Posts
    2
    Rep Power
    0
    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.

    I'd suspect that you can even connect to a SQL Server 2016 database using this method along with any other ODBC compliant database (but probably not a 64-bit version).
    While the other advice to move the program to an updated language is the obvious answer - it should be possible to work with VB3 and SQL server - maybe only SQL server 2000

    You can't use ADO with VB3 however

    I am in a similar position with a number of customers using applications written in VB3 and using ms-access 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.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2016
    Location
    Adelaide
    Posts
    2
    Rep Power
    0
    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 Sub

IMN logo majestic logo threadwatch logo seochat tools logo