Articles

Sql connection string VB6

March 8, 2005 at 02:32:39
Specs: winxp pro sp2, 386mb ram p3 733

OK im trying to connect my local machine to my local sql database in VB6 but the connection strings i`ve tried dont work, i have set ado 2.7 as a reference ,the sql service is running
as server name "ANTHONYW" another c++ database program works with this set up, i just need the correct connection string for vb6, Please help, Thanks Ant.

See More: Sql connection string VB6

Report •


#1
March 8, 2005 at 08:38:40

try this:
dim cn As New ADODB.connection
dim rs As New ADODB.Recordset
'To Opent the Connection
If cn.state = 0 Then cn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=yourdatabasenamehere;Data Source=."
'Put Your Database name as Initial Catalog

if you are running a single database server in your envoirnment then don't change "." at Datasource in connection string otherwise replace "." with your sqlserver name.


Report •
Related Solutions


Ask Question