Error Selecting values fron SQL Server2000 DB

Hi:I am trying to execute a SQl statement pulling a column from SQl Server2000 database. The statement executes and returns ten rows. The Messagebox(temp_var) displays “False” as the value instead of the actual column value.

I tried the index number instead of the column name, but still the same result.

What is wrong with the code?

Do I have to do any kind of conversion on the result set before I can get to the values?

Thanks for the help.


Dim workspace As New NotesUIWorkspace

Dim session As New NotesSession

Dim temp_var As String

Set con = New ODBCConnection

Set qry = New ODBCQuery

Set result = New ODBCResultSet

Set qry.Connection = con

Set result.Query = qry

status = con.ConnectTo(“ABC”, “XXXX”, “XXXXX” )

If status = False Then

Messagebox(“Testing SQL ODBC Connection: Not Connected”)

Exit Sub

End If

qry.SQL = “SELECT LastName FROM Employees”

result.Execute

If Not result.IsResultSetAvailable Then

Messagebox “Couldn’t get result set”

Exit Sub

End If

Do

result.NextRow

Call result.FieldExpectedDataType(“LastName”, DB_CHAR)

temp_var = result.GetValue(“LastName”)

Messagebox(temp_var)

Loop Until result.IsEndOfData

result.Close(DB_CLOSE)

con.Disconnect

Messagebox(“End of Testing SQL ODBC Connection”)

Subject: Error Selecting values fron SQL Server2000 DB

Ajay did you ever resolve this error? If so please share, I am having the same problem. thanks…

Subject: Error Selecting values fron SQL Server2000 DB