i used this codes to show the records but this doesnt works .. but when use the query
("Select * from Schedulings") it works .. it shows the all records. but i want to show the records that satisfy this query..
("Select * from Schedulings where YearLevels = '" & search.TextBox1.Text & "' And Sections = '" & search.TextBox12.Text & "' ", asconn)
Imports System
Imports System.Data
Imports System.Data.OleDb
Imports System.Windows.Forms.Form
Public Class ScheduleStud
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Dim com As OleDbCommand
Dim rid As OleDbDataReader
Dim Con1 As New ADODB.Connection
Dim rs As ADODB.Recordset
Dim ds As DataSet
Dim da As New OleDbDataAdapter
Dim lastrow As Integer
Dim myrow As Data.DataRow
Private Sub ScheduleStud_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
EnlistmentModule.connect()
showmyrecords()
End Sub
Public Sub showmyrecords()
Dim lvi As ListViewItem
Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)
Dim da As New OleDbDataAdapter("Select * from Schedulings where YearLevels = '" & search.TextBox1.Text & "' And Sections = '" & search.TextBox12.Text & "' ", asconn)
da.Fill(dt)
Dim acscmd As New OleDb.OleDbCommand
acscmd.CommandText = strsql
acscmd.Connection = asconn
ListView1.Items.Clear()
For Each myrow__1 As DataRow In dt.Rows
lvi = New ListViewItem()
lvi.Text = myrow__1(5)
lvi.SubItems.Add(myrow__1(6))
lvi.SubItems.Add(myrow__1(7))
lvi.SubItems.Add(myrow__1(8) + "-" + (myrow__1(9)))
lvi.SubItems.Add(myrow__1(10))
ListView1.Items.Add(lvi)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
asconn.Close()
End Sub
End Class