Link to home
Start Free TrialLog in
Avatar of CharlieDev
CharlieDevFlag for United Kingdom of Great Britain and Northern Ireland

asked on

c#, asp.net- help with basic photo uploader

Hi,
I am trying to get a basic photo uploader working to see how it works. I'm using the tutorial : http://www.codeproject.com/KB/aspnet/simpleuploadimage.aspx

I am having troubles with  adding the image to the database using the stored proceedure, so I want to change the code on the site to add:

   //Execute the procedure with Microsoft.ApplicationBlocks.Data
            DBConnect.OpenConnection();

            SqlCommand commandaddEvent = new SqlCommand("exec usp_AddPhoto @Photo", DBConnect.conn);

            commandaddEvent.Parameters.Add("Photo", SqlDbType.UniqueIdentifier);
            commandaddEvent.Parameters["Photo"].Value = photo;
           
            commandaddEvent.ExecuteNonQuery();

            DBConnect.CloseConnection();


            //Simple procedure

            /*CREATE PROCEDURE sp_img(@img image)  AS

            insert into tb_img values(@img)*/

            //record data

            SqlHelper.ExecuteNonQuery(connectionString,"sp_img",obj);    

What variable or reference is the image for me to reference to photo in the following line?:   commandaddEvent.Parameters["Photo"].Value = photo;
Thanks
ASKER CERTIFIED SOLUTION
Avatar of apresto
apresto
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CharlieDev

ASKER

Hi Apresto,
I wont store the files in the database then! So I'll need some help to store them elsewhere. I'll post a new question and hope you'll help with that!! :)
Thanks