Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Sql Query and Datagrid problem


Sql Query and Datagrid problem

Author
Message
lkr
lkr
Forum God
Forum God (439 reputation)Forum God (439 reputation)Forum God (439 reputation)Forum God (439 reputation)Forum God (439 reputation)Forum God (439 reputation)Forum God (439 reputation)Forum God (439 reputation)Forum God (439 reputation)

Group: Forum Members
Posts: 1, Visits: 4
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

Joey
Joey
Forum God
Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)

Group: Forum Members
Posts: 72, Visits: 46
You need to set the CursorLocation Property of the Recordset Object.



rs.CursorLocation=adUseClient





Place this line of code before opening the Recordset.
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search