Link to home
Start Free TrialLog in
Avatar of Joncarl
JoncarlFlag for United States of America

asked on

Sql Error windows 7 Invalid Authorization specification

Getting the following error on a WIndows 7 64bit machine but applicationworks fine on XP.

Invalid Authorization specification

We are running Vb6 Code and accesing a SQL Database getting the erri when I refresh the ADODC .Refresh in VB Here is my code for testing. It works fine in XP 32bit

Private Sub Form_Load()
Dim strSql As String
Set gconnsql = New ADODB.Connection
Set AdoSoHdr = New ADODB.Connection
AdoSoHdr.ConnectionString = "Provider=sqloledb;server=W2000S45;" & _
                      "uid=test;pwd=test;database=EMS;"
           AdoSoHdr.Mode = adModeRead
'           AdoSoHdr.CursorType = adOpenKeyset
           AdoSoHdr.CursorLocation = adUseClient
gconnsql.ConnectionString = pSqlConnStringA                      
860         strSql = "Select * From TblDocHdr Where ID<10" '
Me.Adodc1.ConnectionString = gconnsql
Me.Adodc1.UserName = ""
Me.Adodc1.Password = ""
Me.Adodc1.RecordSource = strSql
MsgBox "Step-1"
Me.Adodc1.Refresh -------------------- BLows up Here
MsgBox "step-2"

Me.TDBGridDoc2.Refresh
End Sub

Avatar of Banthor
Banthor
Flag of United States of America image

your provider in the connection string is the issue.
Here is the easy way to create a tested connection string.
Create text file and rename to connect.udl
Double click and enter all the settings you require and test.
Rename the file connect.txt or just drag into notepad to read the correct contents needed for the connection string.
 
Avatar of Joncarl

ASKER

Also if I comment out the line Me.Adodc1.Refresh it works on the WIndows 7 Box.
Avatar of Joncarl

ASKER

Still get (Invalid Authorization specification) at the following line works if not their.

Me.Adodc1.Refresh -------------------- BLows up Here In Windows 7 when this is their.

Avatar of Joncarl

ASKER

Here is my code file for VB 6
Avatar of Joncarl

ASKER

Here is my code file for VB 6

Form1.frm
ASKER CERTIFIED SOLUTION
Avatar of Veerabhadraiahhv
Veerabhadraiahhv
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jdinucci
jdinucci

hi ,  Javier in Argentina !!
 
I have the same problem : in XP works Ok the program but in Win 7 no... ( Invalid Authorization specification)

My example ...

Public Function StaticQuery(pQry As String) As Recordset
Dim oRs As ADODB.Recordset
Dim i As Long

Dim sError As String
Dim lError As Long

On Error GoTo errorHandler

    Set oRs = New ADODB.Recordset
    oRs.ActiveConnection = mConSql.ConnectionString
    oRs.CursorLocation = adUseClient
    oRs.CursorType = adOpenStatic
    oRs.Open pQry
   
    Set StaticQuery = oRs

Why in XP works OK ??? with the same Connection String ...?????
hi,
Besides the link that the expert introduced :
http://visual-basic.itags.org/visual-basic/271436/ not exits now....

Thanks , Javier