Avatar of CharlieDev
CharlieDev
Flag 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
C#ASP.NET

Avatar of undefined
Last Comment
CharlieDev

8/22/2022 - Mon