How connect to database without DSN?
Posted on 2006-03-24
I have written many applications in vb 6 that produce reports in cr 9. Each time I use a DSN to connect to the MS SQL Server database both in my vb 6 applications and in the cr 9 reports. All the cr reports are imported into vb 6. That always works just fine.
Now, however, my company is asking me to not use DSNs any more and to, instead, use connection strings. So in my vb 6 code I now use:
cnOCCS_Job_Request.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=OCCS_Job_Request;Data Source=LVXS7601"
cnOCCS_Job_Request.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=DSN-OCCS_Job_Request"
That method works fine in vb 6. It also works fine in cr 9 when I create and run the report from within the cr developement environment. But when I import the cr report into vb 6 and run it, I get the following error message: "Crystal Reports Viewer Logon failed. Details: ADO Error Code: xxxx Source: Microsoft OLE DB Provider for SQL Server. Description: Login failed for user 'sa'...."
I have tried in cr 9 using both the ODBC (RDO) and the OLE DB (ADO) connection methods, but I can't figure out how to get them to work, i.e. to successfully run in my vb 6 application.
Thank you for the help.