Tech
Forums
Jobs
Books
Events
Live
Interviews Prep
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
use DataSet and table Adapter
Sulieman Alkatib
May 23 2017 4:59 AM
190
Reply
It's my first time to use dataset and table adapter. I'm trying to make insert , view all records and search for specific record in VB.
There is no errors but non of the buttons works
anyone have an idea how to make this work ?
also I wand the table to be refreshed every time I insert a record
Imports
System.Data.SqlClient
Public
Class
Form1
Private
Sub
Form1_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Load
Me
.Product_masterTableAdapter.Fill(
Me
.DBDataSet.Product_master)
InitializeComponent()
End
Sub
Private
Sub
Button3_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
'to search for record by product number
Dim
search
As
String
= TextBox1.Text
Try
Me
.Product_masterTableAdapter.FillBysearch(
Me
.DBDataSet.Product_master, search)
InitializeComponent()
Catch
End
Try
End
Sub
Private
Sub
Button4_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
'to display all records
Me
.Product_masterTableAdapter.Fill(
Me
.DBDataSet.Product_master)
InitializeComponent()
End
Sub
Private
Sub
Button1_Click(sender
As
Object
, e
As
EventArgs)
Handles
Button1.Click
Dim
pdt
As
Integer
Dim
desc
As
String
=
""
Dim
pro
As
Integer
Dim
uni
As
String
=
""
Dim
qty
As
Integer
Dim
rec
As
Integer
Dim
cos
As
Integer
Dim
sel
As
Integer
Me
.Product_masterTableAdapter.InsertQuery(pdt_no:=pdt, descr:=desc, profit_percent:=pro, uni_measure:=uni, qty_on_hand:=qty, recorder_level:=rec, cost_price:=cos, sell_price:=sel)
Label9.Text =
"Product inserted"
End
Sub
End
Class
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
How to Set Footer IN RDLC reports in Window C#
How to license an Application in Winform