Computing.Net > Forums > Programming > Sql connection string VB6

Sql connection string VB6

Reply to Message Icon

Original Message
Name: Anthony Arde
Date: March 8, 2005 at 02:32:39 Pacific
Subject: Sql connection string VB6
OS: winxp pro sp2
CPU/Ram: 386mb ram p3 733
Comment:

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.


Report Offensive Message For Removal

Response Number 1
Name: secrets
Date: March 8, 2005 at 08:38:40 Pacific
Subject: Sql connection string VB6
Reply: (edit)

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 Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Sql connection string VB6

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software