views:

987

answers:

1

I recently migrated a database from sql server 2005 to 2008 on windows server 2008. Clients connect fine from their XP machines and so does the SQL Management Studio 2008. I have also tested a remote connection using LINQPad which worked fine.

However on my VB6 app, the connection string seems to give me problems. Any ideas what I'm doing wrong?

    Dim strUserName As String
     Dim strPassword As String
     Dim sProc As String

     sProc = "Class_clsAdoFnx_Initialize"

        Me.DatabaseName = "db_app"




 'Connect to SQL Server

    strUserName = "admin"
    strPassword = "mudslinger"

    Set cSQLConn = New ADODB.Connection
    '**Original connection String
    'cSQLConn.CommandTimeout = 0
    'cSQLConn.ConnectionString = " PROVIDER=SQLOLEDB" & _
    '    ";SERVER=NET-BRAIN" & _
    '    ";UID=" & strUserName & _
    '    ";PWD=" & strPassword & _
    '    ";DATABASE=" & Me.DatabaseName

    '***First attempt, no dice
    'cSQLConn.ConnectionString = "Provider=sqloledb;" & _
    '       "Data Source=NET-BRAIN;" & _
    '       "Initial Catalog=DB_APP;" & _
    '       "User Id=admin;" & _
    '       "Password=mudslinger"
    'cSQLConn.Open

    '***3rd attempt, no dice 
    cSQLConn.Open "Provider=sqloledb;" & _
           "Data Source=NET-BRAIN;" & _
           "Initial Catalog=db_app;" & _
           "User Id=admin;" & _
           "Password=mudslinger", "admin", "mudslinger"

thanks in advance.

UPDATE: Here is the string I generated using my test.UL file

[ODBC] Provider

Provider=MSDASQL.1;Password=logmein;Persist Security Info=True;User ID=sa;Extended Properties="DSN=NET-BRAIN;UID=admin;PWD=mudslinger;APP=Microsoft® Windows® Operating System;WSID=BPOOR-16D68FBC7D;DATABASE=DB_App;Network=DBMSSOCN";Initial Catalog=DB_App

Here is the same UL file using the SQL Native provider:

"Provider=SQLNCLI10.1;Integrated Security="";Persist Security Info=False;User ID=admin;Initial Catalog=DB_APP;Data Source=NET-BRAIN;Initial File Name="";Server SPN="""

--received the error: Error in Ado Call... There was an error in Class_clasAdoFnx_initialize 3001 Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. --Error: Class_clsAdoFnx_Initialize 3709 Requested operation requires an OLE DB Session object, which is not supported by current provider.

tried [oledb] for sql server provider option "Provider=SQLOLEDB.1;Password=mudslinger;Persist Security Info=True;User ID=admin;Initial Catalog=db_app;Data Source=net-brain"

error: -2147217900 Login failed for user 'admin'

UPDATE2 : After isolating the open connection string, it turns out the connection is opening and the stored procedure I was using to test with was failing.

A: 

Following Using ADO with SQL Server Native Client to enable the usage of SQL Server Native Client, ADO applications will need to implement the following keywords in their connection strings:

Provider=SQLNCLI10
DataTypeCompatibility=80

Dim con As New ADODB.Connection

con.ConnectionString = "Provider=SQLNCLI10;" _
         & "SERVER=NET-BRAIN;" _
         & "Database=DB_APP;" _ 
         & "DataTypeCompatibility=80;" _
         & "User Id=admin;" _
         & "Password=mudslinger;"

con.Open
volody
I get an error in Ado Call.. "There was an error in Class_clsAdoFnx_Initialize 3706 Provider cannot be found. It may not be properly installed."
phill
I also tried setting provider back to SQLOLEDB and received a similar error
phill
is this client computer has 64 bit OS?
volody
Yes it is. It is running on windows 2008 server
phill
volody
installed... not sure how that made a difference. Do I need to change the connection string to utilize that?
phill
yes use SQLNCLI10 provider
volody
I still receive the same error: -2147467259 Login failed for user 'admin'
phill
One more suggestion, try to create new file test.udl and use it to test connection with different providers.
volody
could you please elaborate on udl? thats very new to me.
phill
create a new file "TEST.UDL" then double click on it and it will open Data Link Properties dialog, select first tab and choose provider like 'Sql Native Client' then select on second tab server name and set user name and password. Then you should be able to see database list and click Test Connection button to verify connection
volody
if you will succeed with connection, then open file in Notepad and copy connection string (password is not saved, you will need to select check box to save password)
volody
I tried to copy the string both with and with out surrounding quotes and it gives me a syntax error in VB6, I will post my resulting string above.
phill
replace single quote with double quote for example instead of Properties="DSN=NET use next Properties=""DSN=NET
volody
as well replace DBMSSOCN";Initial with DBMSSOCN"";Initial
volody
It compiled this time; however when i run it, I get an error that says: -2147217887 [Microsoft][ODBC SQL Server Driver] Optional feature not implemented
phill
Try next connection string, i have removed a few optional parameters: Provider=MSDASQL.1;Password=logmein;Persist Security Info=True;User ID=sa;Extended Properties=""DSN=NET-BRAIN;UID=admin;PWD=mudslinger;DATABASE=DB_App;"";Initial Catalog=DB_AppIs it possible to use another provider with "TEST.UDL"?
volody
I tried 2 other providers and still no luck.
phill
How about SQL Server Native Client
volody
I tried that and posted the error above.
phill
Do you have only connection open code when you did your testing?
volody
After isolating the open connection string, it turns out the connection is opening and the stored procedure I was using to test with was failing. I will post the stored procedure up top.
phill