I've been trying to figure out a connection string for a couple days now. I'm new to ado. I've been using odbc for years, but I want to update the old colde
With ADO - an API which has not been touched for twenty years? (And which was a piece of rubbish already when it was new.) I would recommend that you stick to ODBC.
Anyway, a typical connection string would be:
Set cn = "Provider=SQLOLEDB;Server=MACHINE\SQLEXPRESS;Database=ADOLearn;Trusted_connection=yes" ' Windows authentication.
Set cn = "Provider=SQLOLEDB;Server=MACHINE\SQLEXPRESS;Database=ADOLearn;UID=NameOfUser;PWD=TheSecret" ' SQL authentication.
It's a little confusing, because different APIs uses different keywords for the same thing, so it easy to accidently use something which does not work in a specific context.
One more remark: SQLOLEDB is a very old provider, which you normally should not use with SQL Server, because you are missing out on support for many new features. But since ADO is so old itself, you can just as well use SQLOLEDB, as ADO would only be confused by what is coming through.