/* I HAVE MADE THIS CLASS 'PRODUCT DETAILS' TO SAVE DATA IN DATABASE AND I WANT TO RETRIEVE DATA ON DATA GRID ON LOADING OF CLASS "PRODALL" IN THIS CASE THE DATA IS BEING SAVED BUT THE DATABASE IS NOT UPDATED SO I AM NOT ABLE TO RETRIEVE COMPLETE DATA ON THE GRID. PLZ HELP ME OUT. WAITING FOR REPLY. THANKING U IN ANTICIPATION. */
vb
Public Class productdetails
Dim db As New Database()
Dim activeComponent As TextBox
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
OleDbDataAdapter1.Fill(DataSet11)
Try
Me.BindingContext(DataSet11, "tables1").EndCurrentEdit()
Me.OleDbDataAdapter1.Update(DataSet11)
'ending current editing and updating the dataset
Catch
End Try
Me.BindingContext(DataSet11, "tables1").AddNew()
'adding new record/row to the table
MsgBox("Successfully Inserted")
TextBox1.Enabled = False
TextBox2.Enabled = False
TextBox3.Enabled = False
TextBox4.Enabled = False
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox1.Enabled = True
TextBox2.Enabled = True
TextBox3.Enabled = True
TextBox4.Enabled = True
End Sub
End Class
--------------------------------------------------------------------------------------------------------------------------------------
Public Class prodall
Inherits System.Windows.Forms.Form
Private Sub prodall_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OleDbDataAdapter1.SelectCommand.CommandText = "Select * from product"
DataSet11.Tables.Clear()
OleDbDataAdapter1.Fill(DataSet11)
DataGridView1.DataSource = DataSet11.Tables("product")
DataGridView1.Refresh()
End Sub
EDIT: Code tags added, please use them in the future =>

Also, there is no need to type in all caps, it is rude and considered yelling
This post has been edited by PsychoCoder: 19 Apr, 2008 - 11:20 PM