在此之前,如果我的英语不好我很抱歉 请帮助我,我是vba访问的初学者,我想插入多张照片进行访问,但是这里的“参数@ image1没有默认值”中的“参数没有默认值”始终是错误的。
我有2个表,“ datapenjualan”和“ datagambar”,datapenjualan是父表,datagambar是子表,NoFaktur是2表上的主键 当我在datapenjualan中输入数据时,NoPesanan也会自动将数据输入datagambar。
所以现在我无法在桌子上输入5张照片
这里是我的代码
Imports System.Data.OleDb
Public Class insertpicture
Dim con As New OleDb.OleDbConnection
Dim conString As String
Dim command As New OleDb.OleDbCommand
Dim dialog As New OpenFileDialog
Dim mstream As New System.IO.MemoryStream
Dim arrImage1() As Byte
Dim arrImage2() As Byte
Dim arrImage3() As Byte
Dim arrImage4() As Byte
Dim arrImage5() As Byte
Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PictureBox1.Visible = "False"
PictureBox2.Visible = "False"
PictureBox3.Visible = "False"
PictureBox4.Visible = "False"
PictureBox5.Visible = "False"
End Sub
Private Sub save_button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save_button.Click
conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Ajeng Shaffira\documents\visual studio 2010\Filling Data\Filling Data\DatabaseTransaksiPenjualan.mdb"
If nofaktur.Text = "" Then
MsgBox("Input No Pesanan!")
ElseIf IsNothing(PictureBox1.Image) Then
MsgBox("Select image 1!")
ElseIf IsNothing(PictureBox2.Image) Then
MsgBox("Select image 2!")
ElseIf IsNothing(PictureBox3.Image) Then
MsgBox("Select image 3!")
ElseIf IsNothing(PictureBox4.Image) Then
MsgBox("Select image 4!")
ElseIf IsNothing(PictureBox5.Image) Then
MsgBox("Select image 5!")
Else
Try
con.ConnectionString = conString
con.Open()
Dim command As New OleDbCommand
command.CommandType = CommandType.Text
command.CommandText = "insert into datagambar([FakturInvoice], [SPB&BAPP], [PurchaseOrder], [TandaTerimaInvoice], [FakturPajak]) VALUES (@image1, @image2, @image3, @image4, @image5)"
command.Connection = con
command.Parameters.Clear()
command.Parameters.Add(New OleDbParameter("@image1", OleDbType.VarChar)).Value = arrImage1
command.Parameters.Add(New OleDbParameter("@image2", OleDbType.VarChar)).Value = arrImage2
command.Parameters.Add(New OleDbParameter("@image3", OleDbType.VarChar)).Value = arrImage3
command.Parameters.Add(New OleDbParameter("@image4", OleDbType.VarChar)).Value = arrImage4
command.Parameters.Add(New OleDbParameter("@image5", OleDbType.VarChar)).Value = arrImage5
command.ExecuteNonQuery()****((((here it is my error))))
MsgBox("Pictures Saved!", MessageBoxButtons.OK, MessageBoxIcon.Information)
command.Dispose()
con.Close()
Call bersih()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub
请帮助我:((