Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Create Proc InsertStuff
@description varchar(300),
@image image
as
set nocount on
Insert into SomeTable (Description,Image)
values (@description,@image)
Dim imgToSave as System.Drawing.Image = system.Drawing.Image.FromFile("SomeImage.jpg")
Dim sc As New ImageConverter
Dim buffer() As Byte
buffer = sc.ConvertTo(imgToSave, GetType(Byte()))
imgToSave.Dispose()
imgToSave = Nothing
buffer
Private Function UseInsertStuff (byVal image as byte(), byVal description as string) as Boolean
Dim con as New SqlClient.SqlConnection("server=localhost;database=Northwind;trusted_connection=yes")
Dim cmd as New SqlClient.SqlCommand("InsertStuff",con)
Dim da As New SqlClient.SqlDataAdapter(cmd)
With cmd
.CommandType = CommandType.StoredProcedure
With .Parameters
.Add("@image", SqlDbType.image, 16).Value = image
.Add("@description", SqlDbType.varchar, 300).Value = description
End With
con.Open()
try
cmd.ExecuteNonQuery() ' For a stored proc with no records...
catch ex as exception
'msgbox ex.message
'response.write ex.message
Return False
exit function
Finally
con.Close()
cmd.Dispose()
End Try
End With
Return true
End Function
UseInsertStuff (buffer, "FileName - Or some other data")