3

Goal

We have VB.Net applications currently running and communicating with our cloud database hosted by Microsoft's Azure portal. However, we have some VB6 applications that we would like to do the same.

Attempt

With VB6, I am able to connect to a 2012 SQL Server that is hosted on premiss where I work using the following connection string:

sConnectionString = "Provider=SQLNCLI11;Server=MYSERVERNAME;Database=MYDATABASE;Uid=USERNAME;Pwd=PASSWORD;"

However, when we take a look at the connection string I use in VB.Net to connect to the cloud;

sConnectionString = "Server=tcp:SERVER.database.windows.net,1433;Initial Catalog=MYDATABASE;Persist Security Info=False;User ID=USERNAME;Password=PASSWORD;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"

That's where I run into problems; I cannot use the same connection string for VB6. Take a look at my error:

enter image description here


Finally...

Do we need to upgrade all our VB6 programs to VB.Net? Or perhaps I am missing a reference for my project to work with Azure? Is it even possible for a VB6 app to communicate with Azure?

Alex
  • 4,821
  • 16
  • 65
  • 106
  • Well, if you are still running VB6 i think you should update anyway. It's an old an unsupported technology and it will just be harder and harder to find programmer that can maintain your systems. – litelite Aug 03 '17 at 18:14
  • @litelite Agreed, I've been pushing for that but we have limited time to apply to that, unfortunately. – Alex Aug 03 '17 at 18:16
  • Well just tell your boss that since the tools you use to compile and edit VB6 are not supported anymore they might break anytime. And if they break you will not be able to modify the programs anymore and you will be stuck with a black box praying it does not break. Just like at my job. – litelite Aug 03 '17 at 18:19
  • 1
    You could try creating a Linked Server connection to Azure on your local instance and use that from VB6. – Filburt Aug 03 '17 at 18:19
  • @Filburt I think that solution is looking to be our best bet – Alex Aug 03 '17 at 18:21
  • did you tried on [connectionstrings](https://www.connectionstrings.com/sql-azure/)? There are some slightly differences in the UserId format. – deblocker Aug 03 '17 at 19:11
  • @deblocker Yep, I tried a lot of those and get the error message that I posted as a screenshot. Works on VB.Net though! Just not on VB6 – Alex Aug 03 '17 at 20:07

2 Answers2

3

After messing around with many different connection strings I finally found one that connected:

sConnectionString = "Provider=SQLNCLI11;Password=PASSWORD;User ID=USER@SERVERNAME;Initial Catalog=DATABASE;Data Source=tcp:SERVERNAME.database.windows.net;"
Alex
  • 4,821
  • 16
  • 65
  • 106
0

See ConnectionStrings.com and try with OLE DB or ODBC settings:

https://www.connectionstrings.com/sql-azure/

Giorgio Brausi
  • 414
  • 3
  • 7