01.
Imports
System.Data.OleDb
02.
Public
Class
Form1
03.
Dim
objConnection
As
OleDbConnection
04.
Dim
objCmd
As
OleDbCommand
05.
Dim
strConnection
As
String
06.
Dim
adapter
As
New
OleDbDataAdapter
07.
Dim
ds
As
New
DataSet
08.
Dim
dt
As
New
DataTable
09.
10.
Private
Sub
Form1_Load(sender
As
Object
, e
As
EventArgs)
Handles
MyBase
.Load
11.
12.
strConnection =
"Provider=Microsoft.ACE.OLEDB.12.0;"
& _
13.
"Data Source=D:\PC_CNC.accdb"
14.
15.
16.
objConnection =
New
OleDbConnection(strConnection)
17.
objConnection.Open()
18.
19.
20.
objCmd =
New
OleDbCommand()
21.
objCmd.Connection = objConnection
22.
objCmd.CommandText =
"querypositive"
23.
24.
objCmd.CommandType = CommandType.StoredProcedure
25.
26.
adapter.SelectCommand = objCmd
27.
adapter.Fill(ds)
28.
dt = ds.Tables(0)
29.
30.
31.
32.
33.
dgv1.DataSource = dt
34.
35.
36.
37.
If
dgv1.RowCount > 1
Then
38.
Dim
TotalPrice
As
Integer
= 0
39.
For
index
As
Integer
= 0
To
dgv1.RowCount - 1
40.
TotalPrice += Convert.ToInt32(dgv1.Rows(index).Cells(8).Value)
41.
Next
42.
txt1.Text = Format$(TotalPrice,
"###,###,###,###"
)
43.
End
If
44.
45.
cb1.DataSource = ds.Tables(0)
46.
cb1.DisplayMember =
"Vender"
47.
ListBox1.DataSource = ds.Tables(0)
48.
ListBox1.ValueMember =
"ToolNumberID"
49.
ListBox2.DataSource = ds.Tables(0)
50.
ListBox2.ValueMember =
"Totall"
51.
ListBox3.DataSource = ds.Tables(0)
52.
ListBox3.ValueMember =
"Price"
53.
ListBox4.DataSource = ds.Tables(0)
54.
ListBox4.ValueMember =
"Total Price"