LearningVB
MIS
Hello,
Anyone out there who can tell me why I get the run-time error '7004': "The rowset is not bookmarable" when I am running this programcode?
The wole thing stops when the program attemting to put the data out in the dataGrid dgrTest.
Option Explicit
Private objConn As ADODB.Connection
Private mrsProdName As New Recordset
Const tmpProdNo = 33037
Private Sub OpenConnection()
Set objConn = New ADODB.Connection
objConn.ConnectionString = "PROVIDER=MSDASQL;DSN=Testdsn;UID=sa;Password=test;"
objConn.Open
End Sub
Private Sub GetInfo()
Dim strSQL As String
strSQL = "SELECT ProdNo, ProdName, AltProdno, ProdGroup " _
& "From dekl_MovexProd " _
& "Where ProdNo = " & tmpProdNo
OpenConnection
mrsProdName.Open strSQL, objConn
Set dgrTest.DataSource = mrsProdName
End Sub
Private Sub CloseConnection()
If Not (mrsProdName Is Nothing) Then
Set mrsProdName = Nothing
End If
If Not (objConn Is Nothing) Then
objConn.Close
Set objConn = Nothing
End If
End Sub
Best regard LearningVB (or still LearningVB)
Anyone out there who can tell me why I get the run-time error '7004': "The rowset is not bookmarable" when I am running this programcode?
The wole thing stops when the program attemting to put the data out in the dataGrid dgrTest.
Option Explicit
Private objConn As ADODB.Connection
Private mrsProdName As New Recordset
Const tmpProdNo = 33037
Private Sub OpenConnection()
Set objConn = New ADODB.Connection
objConn.ConnectionString = "PROVIDER=MSDASQL;DSN=Testdsn;UID=sa;Password=test;"
objConn.Open
End Sub
Private Sub GetInfo()
Dim strSQL As String
strSQL = "SELECT ProdNo, ProdName, AltProdno, ProdGroup " _
& "From dekl_MovexProd " _
& "Where ProdNo = " & tmpProdNo
OpenConnection
mrsProdName.Open strSQL, objConn
Set dgrTest.DataSource = mrsProdName
End Sub
Private Sub CloseConnection()
If Not (mrsProdName Is Nothing) Then
Set mrsProdName = Nothing
End If
If Not (objConn Is Nothing) Then
objConn.Close
Set objConn = Nothing
End If
End Sub
Best regard LearningVB (or still LearningVB)