With the below procedure I want to run a stored procedure on a SQL-server 2000, but for some reason I get run-time error -2147217900 (80040e14), stating that the stored procedure doesn't exist.
As it does exist, the connection is open, and running the code in query analyzer works, I center the problem down to the database being used. 
But whats wrong? The user and database has been added to the system dsn AccessSQL, user and passwords works fine in query analyzer.. yet for some reason it apparently sends the ado command to the wrong database, and thus can't find the stored procedure.
Thanks in advance,
Trin
    Dim forbindelse As New ADODB.Connection
    Dim kommando As New ADODB.Command
    Dim pam1, pam2 As ADODB.Parameter
    Dim forbindelseDSN As String
    Dim strSQLland As String
    Dim strSQLtid As String
    forbindelse.Open "DSN=AccessSQL;APP=Track Exporter;Database=Gramex_UDV;Network=DBMSSOCN;", "aaaa", "tttt"
    kommando.CommandText = "TRACK_EXPORT_sp_opdatland"
    kommando.CommandType = adCmdStoredProc
    kommando.ActiveConnection = forbindelse
    Set pam1 = kommando.CreateParameter("land", adChar, adParamInput, 2)
    Set pam2 = kommando.CreateParameter("org", adChar, adParamInput, 4)
    kommando.Parameters.Append pam1
    kommando.Parameters.Append pam2
    pam1.Value = "'" & kombo_land & "'"
    pam2.Value = "'" & kombo_org & "'"
    
    kommando.Execute
    forbindelse.Close
    Set kommando = Nothing
    Set forbindelse = NothingFYI I've attempted with a different connectstring:
forbindelse.Open "provider=SQLOLEDB;Data source=GRAMEXFIN;initial catalog=Gramex_UDV;User ID=AccessBruger;Password=gramex"
Same error...
I've rechecked that the login has execute permission for the stored procedure...|||Problem solved - Turns out the database was setup to use full qualifiers for the object name. 
In this case the stored procedure was to be adressed with its dbo... ket.TRACK_EXPORT... etc. etc..
/Trin
No comments:
Post a Comment