I’m facing problem with SQL Server data retrieval.
The command being used is :
@DbLookup(“ODBC”;“DSNname”;“userid”;“password”;
“dbo.tablename”;“field1”:“Discard”;“field2”;“searchvalue”;“Ascending”);
I have created a DSN for the corresponding database on the server with the name : DSNname, and its test connection is working fine but still facing the error :
Could not execute @Db function
Subject: “Could not execute @Db function” error on ODBC using DBLOOKUP/DBCommand
If you call @DbLookup from a WEB-application and it points to another server is doesn’t work. Checkout the Designer’s Help about this.
Subject: RE: “Could not execute @Db function” error on ODBC using DBLOOKUP/DBCommand
I’m trying to retrieve data from the target SQL server into a Lotus Notes Application. Please suggest any other way.
Instead of @DbLookup at present I’m trying some code written in Lotusscript as follows :
…
Dim con As New ODBCConnection
Dim qry As New ODBCQuery
Dim result As New ODBCResultSet
Dim usr, pswd, dsn, str As String
…
usr=“username”
pswd = “password”
dsn = “DataSourceName”
…
'If con.ConnectTo(dsn, usr, pswd) Then
If con.ConnectTo(DataSourceName) Then
Set qry.Connection=con
Set result.Query=qry
qry.SQL = “select * from tablename”
result.execute
If result.IsResultSetAvailable Then
Msgbox("Result Set Available")
'result.NextRow
'result.CurrentRow
result.FirstRow
'str=result.GetValue("fieldname",str)
'str=Cstr(result.GetValue("fieldname"))
str=result.GetValue("fieldname")
Msgbox(str)
Else
str=""
Msgbox("Result Set Not Available")
End If
result.Close(DB_CLOSE)
con.Disconnect
End If
I have multiple records in the corresponding SQL Server table having the corresponding field of nvarchar datatype.
But instead of the getting the value of the field I’m getting the result as ‘False’. I’m unable to get the reason.
[The commented lines above are those that didn’t worked also.]