这是我的代码:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim myfilelocation As String = "C:\myPictures\myimage.png"
Dim conn As New SqlConnection("Data Source=MUSTAFA\MUSTAFA;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
-------------------------------------------------- --------------------------------------
以下是我的问题:
由于应用程序存储在数据库中,我怎样才能将该代码检索到 vb.net 中,因为我在数据库中看不到它?
您可以看到图像正在从我的机器作为本地获取其路径位置,因此我想将它放在工作组中的其他计算机能够获取图像的地方,或者如何告诉其他计算机将图像存储在我的机器中并检索从这里开始。