Now i want to solve one problem in VB.net if anyone knows the solution of this then plz reply...
Q. Iam creatin one project in VB.Net 2005 with ms Access as Database.
the codes are:
================================================== ========
Code:
Imports System.Data.OleDb
Public Class Form1
Dim da As OleDbDataAdapter
Dim ds As New DataSet
Dim con As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =G:\jatinz project\std.mdb;")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Dim con As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =D:\database pro\cmc.mdb;")
da = New OleDbDataAdapter("Select * from student", con)
'Dim ds As New DataSet
con.Open()
da.Fill(ds, "student")
txtname.DataBindings.Add("text", ds, "student.name")
txtroll.DataBindings.Add("text", ds, "student.roll")
txtcourse.DataBindings.Add("text", ds, "student.course")
End Sub
Private Sub btnprev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnprev.Click
BindingContext(ds, "student").Position = BindingContext(ds, "student").Position - 1
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
BindingContext(ds, "student").AddNew()
MessageBox.Show("Successfully Inserted")
End Sub
Private Sub btndelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndelete.Click
BindingContext(ds, "student").RemoveAt(BindingContext(ds, "student").Position)
End Sub
Private Sub btnnext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnext.Click
BindingContext(ds, "student").Position = BindingContext(ds, "student").Position + 1
End Sub
Private Sub btnupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnupdate.Click
Me.BindingContext(ds, "student").EndCurrentEdit()
da.Update(ds)
End Sub
Private Sub btnfirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfirst.Click
BindingContext(ds, "student").Position = 0
End Sub
Private Sub btnlast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlast.Click
BindingContext(ds, "student").Position = BindingContext(ds, "student").Count - 1
End Sub
Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click
txtname.Clear()
txtroll.Clear()
txtcourse.Clear()
End Sub
End Class
(without using or creating command)
plz reply as soon as possible...

