August 12th, 2003, 01:27 PM
-
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.
August 13th, 2003, 09:35 AM
-
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.
September 21st, 2017, 01:50 AM
-
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.
September 21st, 2017, 02:19 AM
-
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