Click here to Skip to main content
15,921,212 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
please help me, i need show data searching in datagrid. i have example code but its can't compile.
These coding examples that I made.

VB
Option Explicit
Dim conn As ADODB.Connection
Dim Rs As ADODB.Recordset
Dim query As String

Sub setConn()
  Set conn = New ADODB.Connection
End Sub

Private Sub serachCmd_Click()
  Set Rs = New Recordset
  Adodc1.RecordSource = " select * from logfile where no_ponsel = '" & textSearch & "'"
  Set LogDataGrid.DataSource = Adodc1
  'Rs.Open " select * from logfile where no_ponsel = '" & textSearch & "'", conn, adOpenDynamic, adLockOptimistic

  If Adodc1.Recordset.EOF Then
    MsgBox "Record not found"
  Else
    LogDataGrid.DataSource = Adodc1 /* in this is error and message appear "method and data number not found"
    LogDataGrid.Refresh
  End If
End Sub

please help me..thanks
Posted
Updated 29-Sep-11 4:55am
v2

You need to change the line you flagged. Add "Set" to the beginning of the line. See the line near the top of that procedure where you're doing the exact same thing.
 
Share this answer
 
its still cannot compile.
im need to view in datagrid
select * from logfile where no_ponsel = '" & searchtext.text & " ';

but apear message error.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900