Dim sql As String = " INSERT INTO Categories(CategoryName,Description,Picture) VALUES(@name,@descr,@pic) "
Dim cmd As New OleDbCommand(sql, connnect)
cmd.Parameters.AddWithValue("name", TbxName.Text)
cmd.Parameters.AddWithValue("descr", TbxDescr.Text)
Dim fiStrem As New FileStream(TbxFile.Text, FileMode.Open, FileAccess.Read)
Dim binReader As New BinaryReader(fiStrem)
Dim pic() As Byte = binReader.ReadBytes(fiStrem.Length)
cmd.Parameters.AddWithValue("pic", pic)
Dim afftectedrows As Integer = cmd.ExecuteNonQuery()
If (afftectedrows = -1) Then
MsgBox("เกิดข้อผิดพลาด!" & vbNewLine & "ไม่สามารถจัดเก็บข้อมูลได้")
End If
ผมไม่เข้าใจความหมาย Dim afftectedrows As Integer = cmd.ExecuteNonQuery()
If (afftectedrows = -1) Then
MsgBox("เกิดข้อผิดพลาด!" & vbNewLine & "ไม่สามารถจัดเก็บข้อมูลได้")
End If