Dim shw As String = TextBox1.Text
Dim date2 As String = DateTimePicker1.Text
Dim namec As String = TextBox3.Text
Dim objConn As New OleDbConnection
Dim objCmd As New OleDbCommand
Dim strConnString As String
Dim cmdUpdate As New OleDbCommand
Dim img2 As Byte()
olecon = New OleDbConnection
olecon.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\database\database2.accdb;"
olecon.Open()
strConnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\database\databaseorder.mdb;"
objConn.ConnectionString = strConnString
objConn.Open()
Dim i As Integer = ListView1.Items.Count - 1
For j As Integer = 0 To i
Dim num As String = ListView1.Items(j).SubItems(0).Text
Dim barp As String = ListView1.Items(j).SubItems(1).Text
Dim namep As String = ListView1.Items(j).SubItems(2).Text
Dim pricep As Double = ListView1.Items(j).SubItems(3).Text
Dim coup As Double = ListView1.Items(j).SubItems(4).Text
Dim sump As Double = ListView1.Items(j).SubItems(5).Text
oledb = "select * from warehouse where barcode = '" & barp & "'"
Dim dts2 As DataTable = cmd_excuteToDataTable()
MsgBox(oledb)
img2 = dts2.Rows(0)("picofpro")
cmdUpdate.CommandText = "INSERT INTO ordercus (order_code,no_id,barcode,namecus,namepro,pricepro,countpro,sumprice,dateorder,pic_pro) VALUES ('" & shw & "','" & num & "','" & barp & "','" & namec & "','" & namep & "','" & pricep & "','" & coup & "','" & sump & "','" & date2 & "',@img);"
cmdUpdate.Parameters.Add("@img", OleDbType.LongVarBinary).Value = img2
cmdUpdate.CommandType = CommandType.Text
cmdUpdate.Connection = objConn
cmdUpdate.ExecuteNonQuery()
ขอบคุณครับ
Tag : .NET, Ms Access, Crystal Report, Win (Windows App), VB.NET, Windows