I hope someone can help me. I need to be able to have a form on a page that a uesr can enter in the path, or url to an image. Once they click submit the image should display in a GridView control. Is there anyway to do this, or am I on the wrong page here?? This is the code I have to save to the database:
Public Sub InsertCatalogItem(ByVal Path As String, ByVal desc As String, ByVal image As String, ByVal cost As Decimal, ByVal color As String)
' Declare variables
Dim sqlConn As OleDbConnection
Dim oCommand As OleDbCommand
Dim stmt As String
Dim param As OleDbParameter
' creates a new connection to MSAccess Database opens a new connection
sqlConn = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Path & "")
sqlConn.Open()
oCommand = New OleDbCommand()
oCommand.Connection = sqlConn
stmt = "INSERT INTO tCatalog (tDescription, vImage, cCost, vColor) VALUES ( @desc, @image, @cost, @color)"
'declare parameter objects for the command object
param = New OleDbParameter()
param.ParameterName = "@desc"
param.Value = desc
oCommand.Parameters.Add(param)
param = New OleDbParameter()
param.ParameterName = "@image"
param.Value = image
oCommand.Parameters.Add("param")
param = New OleDbParameter()
param.ParameterName = "@cost"
param.Value = cost
oCommand.Parameters.Add(param)
param = New OleDbParameter()
param.ParameterName = "@color"
param.Value = color
oCommand.Parameters.Add(param)
oCommand.CommandText = stmt
oCommand.CommandType = CommandType.Text
oCommand.ExecuteNonQuery()
sqlConn.Close()
End Sub
Access DBs are dicey at best on the web. Using them to store binaries is pure folly. I’d upgrade the database engine–sql express is free and easy–or re-engineer.
Did you get solution for this? i have created an access database. I want to insert image and display it in gridview using c#. Please let me know if you can help me with the code.