Joncarl
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;databas e=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
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=
"uid=test;pwd=test;databas
AdoSoHdr.Mode = adModeRead
' AdoSoHdr.CursorType = adOpenKeyset
AdoSoHdr.CursorLocation = adUseClient
gconnsql.ConnectionString = pSqlConnStringA
860 strSql = "Select * From TblDocHdr Where ID<10" '
Me.Adodc1.ConnectionString
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
ASKER
Also if I comment out the line Me.Adodc1.Refresh it works on the WIndows 7 Box.
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.
Me.Adodc1.Refresh -------------------- BLows up Here In Windows 7 when this is their.
ASKER
Here is my code file for VB 6
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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 ...?????
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
Besides the link that the expert introduced :
http://visual-basic.itags.org/visual-basic/271436/ not exits now....
Thanks , Javier
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.