Sql Error windows 7 Invalid Authorization specification

Joncarl
Joncarl used Ask the Experts™
on
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

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
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.
 

Author

Commented:
Also if I comment out the line Me.Adodc1.Refresh it works on the WIndows 7 Box.

Author

Commented:
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.

HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Author

Commented:
Here is my code file for VB 6

Author

Commented:
Here is my code file for VB 6

Form1.frm

Commented:
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 ...?????

Commented:
hi,
Besides the link that the expert introduced :
http://visual-basic.itags.org/visual-basic/271436/ not exits now....

Thanks , Javier

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial