How to save Telerik RadBinaryImage image to SQL Server database

Dtqstdreqhkgj

New Member
I have a Telerik RadBinaryImage control which is displaying an image loaded using Telerik RadAsyncUpload.I have an SQL table containing a 'Photo' column (image data type). I want to save to the database the image from the Telerik RadBinaryImage to the insert function which look like this:\[code\]Private Sub InsertPhotoIntoDB() Dim sMyConn As String = My.Settings.appDBConnString Dim myConnection As SqlConnection Dim myCommand As New SqlCommand myConnection = New SqlConnection(sMyConn) myConnection.Open() myCommand = New SqlCommand("INSERT INTO Photos(Photo) VALUES(@Photo)") myCommand.Connection = myConnection myCommand.Parameters.Add("@Photo", SqlDbType.Image, 0, "Photo") myCommand.Parameters("@Photo").Value = http://stackoverflow.com/questions/13705628/WhatDoIPutHere??? myCommand.ExecuteNonQuery() myConnection.Close() myConnection.Dispose()End Sub\[/code\]I've tried:\[code\]myCommand.Parameters.Add("@Photo", SqlDbType.Image).Value = http://stackoverflow.com/questions/13705628/RadBinaryImage1.DataValue\[/code\] but I still get an error:The parameterized query '(@Photo image)INSERT INTO Photos (Photo) VALUES (@Photo)' expects parameter '@Photo', which was not supplied.Do I need to convert RadBinaryImage1.DataValue to image?
 
Back
Top