Hi friends, I'm having a query to the table in MSSQL. In the beginning, "set in dgridsonmust.datasour = rs" line "Run Time Error 7004: Row set is not bookmarkable" I get the error. I've searched and I've left behind this error, but the data does not come DataGrid. I'm asking for your help. Codes are as follows. I'm sorry my bad english. Option Explicit
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sql As String
Private Sub Form_Load()
con.CursorLocation = adUseClient
rs.CursorLocation = adUseClient
Set rs = New ADODB.Recordset
con.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=blank;Data Source=ANDACSQLEXPRESS", adOpenDynamic, adLockOptimistic
sql = "select top 2 t1.musisim, t2.Tipi, t1.crdmiktar from slthareket t1, Islemler t2 " & _
" where t1.musisim = (select top 1 musisim from slthareket" & _
" Where mknno = " & mdltanim.mkno & _
" order by hareketkod desc)" & _
" and t1.odmtipi = t2.Kod" & _
" order by t1.hareketkod desc"
Set rs = con.Execute(sql)
Set dgridsonmust.DataSource = rs
con.Close
End Sub
|