これが私のコードです:
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に取得するにはどうすればよいですか?
画像が私のマシンからローカルとしてパスの場所を取得していることがわかるので、ワークグループ内の他のコンピューターが画像を取得できる場所に配置するか、他のコンピューターに画像を自分のマシンに保存して取得するように指示する方法を指定しますここから。