Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim mycon As OleDbConnection
Dim mycmd As OleDbCommand
Dim dr As OleDbDataReader
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
mycon = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\poonam\eg.mdb")
mycon.Open()
mycmd = New OleDbCommand("select * from t1", mycon)
dr = mycmd.ExecuteReader
If (dr.Read) Then
TextBox1.Text = dr("roll no")
TextBox2.Text = dr("name1")
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If (dr.Read) Then
TextBox1.Text = dr("roll no")
TextBox2.Text = dr("name1")
End If
End Sub
End Class
No comments:
Post a Comment