Formumuza 7 adet TextBox,2 adet RadioButton , GroupBox ve 1 adet Button ekleyin.
Şekil 1
Şekil 2
Form1.vb
Imports System
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RadioButton1.Checked = True
End Sub
Private Sub btnAra_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAra.Click
Dim baglan As OleDb.OleDbConnection = New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=bilgi.accdb;")
Dim str As String
If RadioButton1.Checked Then
str = "SELECT * FROM PersonelListesi Where id='" & Val(TextBox1.Text) & "' "
Else
str = "SELECT * FROM PersonelListesi Where Ad='" & TextBox1.Text & "' "
End If
Dim da As OleDbDataAdapter = New OleDbDataAdapter(str, baglan)
baglan.Open()
Dim ds As DataSet = New DataSet()
da.Fill(ds, "PersonelListesi")
TextBox2.DataBindings.Clear()
TextBox3.DataBindings.Clear()
TextBox4.DataBindings.Clear()
TextBox5.DataBindings.Clear()
TextBox6.DataBindings.Clear()
TextBox2.DataBindings.Add("Text", ds.Tables(0), "Ad")
TextBox3.DataBindings.Add("Text", ds.Tables(0), "Soyad")
TextBox4.DataBindings.Add("Text", ds.Tables(0), "Birim")
TextBox5.DataBindings.Add("Text", ds.Tables(0), "Telefon")
TextBox6.DataBindings.Add("Text", ds.Tables(0), "Mail")
baglan.Close()
End Sub
End Class
0 comments:
Yorum Gönder