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)
-
- 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)
-
-
- 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