VB.NET Search By Sno & Search Between Date
Imports System.Data.OleDb
Public Class Form1
Dim cnn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\BCA\VB.NET Program\employ.accdb")
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim cmd As New OleDbCommand("select * from stud", cnn)
Dim da As New OleDbDataAdapter(cmd)
Dim ds As New DataSet
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
End Sub
------------------------------------------------------------------------------------------------------
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim cmd As New OleDbCommand("select stud.Sname,book.Bname,issu_date from stud,book where stud.sno=" & TextBox1.Text & "and stud.sno=book.sno", cnn)
Dim da As New OleDbDataAdapter(cmd)
Dim ds As New DataSet
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
Dim cmd1 As New OleDbCommand("select count(*) from stud ,book where stud.sno=" & TextBox1.Text & "and stud.sno=book.sno", cnn)
cnn.Open()
Label4.Text = "Total No Of Books Are : " & cmd1.ExecuteScalar
cnn.Close()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim cmd As New OleDbCommand("select * from book where iss_date between " & DateTimePicker1.Value.Date.ToOADate() & "and" & DateTimePicker2.Value.Date.ToOADate() & "", cnn)
Dim da As New OleDbDataAdapter(cmd)
Dim ds As New DataSet
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
End Sub
End Class
0 Comments
Post a Comment