setting the datasource for datagrid - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

setting the datasource for datagrid

mhykemhyke Posts: 16Member
hi i would like to appreciate if someone could help me out with my problem with datagrid control in populating it.

here is my code.

Private Sub cmdSearch_Click()

ConnectToDatabase

Dim rsTemp As ADODB.Recordset
Dim strSearchBy As Long

Set rsTemp = New ADODB.Recordset
rsTemp.Open "SELECT * FROM subdetails WHERE UserID = '" & txtSearchFor.Text & "'", conn, adOpenDynamic, adLockOptimistic
MsgBox rsTemp.RecordCount
'rsTemp.Open "Select * from subdetails", conn, adOpenDynamic, adLockOptimistic

Set dtgDetails.DataSource = rsTemp
'Set mflexDetails.DataSource = rsTemp
'mflexDetails.Refresh
dtgDetails.Refresh
End Sub

Public Sub ConnectToDatabase()
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "database.mdb"
conn.Open
End Sub

ERROR MESSAGE:

run time error 7004
" the rowset is not bookmarkable ! "
mflexDetails.Refresh

Please try to help me out on this one... thanks

mhyke
Sign In or Register to comment.