我的守则是:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim myfilelocation As String = "C:myPicturesmyimage.png"
Dim conn As New SqlConnection("Data Source=MUSTAFAMUSTAFA;Initial Catalog=Tijaabo;User ID=sa;Password=123")
Dim cmd As New SqlCommand("insert into customers(CustomerID,fname) Values( " & CustomerIDTextBox.Text & " , " & FnameTextBox.Text & " )", conn)
Dim cmd1 As New SqlCommand("update customers set photo = @picturebox where CustomerID=" + CustomerIDTextBox.Text, conn)
Dim param As New SqlParameter("@picturebox", SqlDbType.VarBinary)
Dim ImageData As Byte() = IO.File.ReadAllBytes(myfilelocation)
param.Value = ImageData
cmd.Parameters.Add(param)
cmd.Parameters.AddWithValue("@CustomerID", 3)
Try
conn.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
conn.Close()
End Try
End Sub
------------------------------------------------------------------------------------------
我的问题是:
由于申请在数据库中储存,我如何能够将该守则检索到门槛值中,因为我可以将其输入数据库?
你们可以看到,图像正从我的机器中找到其位置,因为我要么想把它放在能够获取图像的其他计算机的某个地方,要么告诉其他电脑,把图像储存在我的机器中,然后从这里检索。