
RDO: Connecting to SQL server table containing an identity column
The following code will get your data and return it in a variant as a
multi-dim array. You don't need to do that you could just do whatever it
is you want with the data right after the OpenResultset() function. Also
the assumption is that you have a global connection handle defined as
'ghConn'.
Public Function GetData(zToolID as string, vData as variant)
dim zSQL as string
Dim rs As rdoResultset
On Error GoTo ERRDB
zSQL = "SELECT iID, szALTX, bitAL_State, bitRequired "
zSQL = zSQL + "FROM tblAlarms "
rdoErrors.Clear
Set rs = ghConn.OpenResultset(Name:=zSQL, Type:=rdOpenStatic,
LockType:=rdConcurReadOnly)
If rs.RowCount > 0 Then
vAlarms = rs.GetRows(rs.RowCount)
GetData = SUCCESS
Else
GetData = NO_RECS
End If
rs.Close
End Function
Tom
Quote:
> Does anybody know how to open a rdoResultset to a SQL server table
> containing an identity column without using a RDO or DAO control?
> Thanks in advance!
> Mark