Click here to Skip to main content
14,736,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i Have a radioButton called rdoFP_JD, which is using a SaveFileDialog to select a picture. I want to know how to store that image file selected into the database once it begins the insert command.

insertCommand.Parameters.AddWithValue("@ASAM_FIRMA", SqlDbType.Image).Value = rdoFP_JD.Image


I have already tried with this but it gives me this error

The parameterized query '(@ASAm_FECHA datetime, @ASAM_VER
nvarchar(60, @ASAM_LUGAR nvar'expects the parameter
'@ASAm_FIRMA_PRES_JD', which was not supplied.

Thanks.
Posted
Updated 26-Mar-13 6:10am
v2

1 solution

The error message that you provided says that the expected parameter is "@ASAm_FIRMA_PRES_JD' but you show in your example code that you are setting the parameter name to "ASAM_FIRMA".

The name that you use when you add the paramater has to match the name that the SQL Server expects. "_PRES_JD" is on the end of what the SQL Server expects but is not on the end of the parameter name when you call the AddWithValue method.
   
Comments
TesterJSR 26-Mar-13 13:12pm
   
Thanks after making all changes I'm getting now Operand type clash:nvarchar is incompatible with image
In the database I have the collumn set to Image
Mike Meinz 26-Mar-13 13:33pm
   
So, what is the Data Type of "rdoFP_JD.Image"?

If you expect quick help, you're going to have to provide some more information. Please use Improve Question above to disclose more about your code.

Maybe show all of the AddParameter statements, the declarations for the values that are used in the AddParameter statements and the declarations for the columns in the SQL Server. We need to double-check every column that the SQL Server expects on this INSERT as well as every parameter that is input to the SQL Server for this INSERT.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900