Heya,
I am working on a code which will allow users to upload images, but unlike most other projects, I do not need to know which user uploaded it, but for which section it was meant and whether it is a first picture, second or 6th...
Current code I am using is following:
CODE
SqlCommand command = new SqlCommand( "UPDATE Web SET '" + imgName + "' = @img_data WHERE Strana = 'HomeStrana' ", connection );
Web = database name
imgName is string variable which equals to the text of textbox for inputing image name (later on I plan to make a check whether some of the image fields is empty for that category and if yes, put first empty picture field as a default value here)
@img_data is a parameter which holds the actual picture
Strana = category where it should be uploaded.
I tried using
CODE
SqlCommand command = new SqlCommand( "UPDATE Web SET @img_name = @img_data WHERE Strana = 'HomeStrana' ", connection );
as well, but it kept saying "image is incompatible with varchar" meaning he thinks I want to put value of @img_data into @img_name... but I just want him to use @img_name as field name and @img_data as value which needs to be inserted into that field.
Thanks in advance (will thank later of course as well

).