Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,074 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,781 people online right now. Registration is fast and FREE... Join Now!




data retrieval in vb.net2005

 
Reply to this topicStart new topic

data retrieval in vb.net2005

d4d2
19 Apr, 2008 - 11:02 PM
Post #1

New D.I.C Head
*

Joined: 19 Apr, 2008
Posts: 1

/* 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 => code.gif
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
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 11:08PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month