I'm converting an old VB6 program to use SQL Server from MS Access. In Jet we can use .Index and .Seek to find a record based on the primary key.
With OpenTable
.ActiveConnection = DB
.Source = TableName
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open Options:=adCmdTableDirect
End With
If Not NoParams Then
If DbIs <> "SQLServer" Then
OpenTable.Index = PK
OpenTable.Seek PK1, adSeekFirstEQ
Else
'???????
End If
TableOpen = True
End If
How do you do the same thing with SQL Server?
With OpenTable
.ActiveConnection = DB
.Source = TableName
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open Options:=adCmdTableDirect
End With
If Not NoParams Then
If DbIs <> "SQLServer" Then
OpenTable.Index = PK
OpenTable.Seek PK1, adSeekFirstEQ
Else
'???????
End If
TableOpen = True
End If
How do you do the same thing with SQL Server?