Here is my code:

override protected void OnInit(EventArgs e)
        {

            InitializeComponent();
            base.OnInit(e);
        }


        private void InitializeComponent()
        {
            this.cmdUpload.Click += new System.EventHandler(this.cmdUpload_Click);
            this.Load += new System.EventHandler(this.Page_Load);


        }


private string strConn;
OdbcConnection cnn;

private void cmdUpload_Click(object sender, System.EventArgs e)
        {
            OpenDatabase();

           

            if ((File1.PostedFile != null) && (File1.PostedFile.ContentLength > 0))
            {

                // Create a byte[] from the input file
                int len = File1.PostedFile.ContentLength;
                byte[] pic = new byte[len];
                File1.PostedFile.InputStream.Read(pic, 0, len);
                string sql1 = "INSERT INTO picture (Picture) VALUES" + "(" + (pic) + ")";
                OdbcCommand cmd = new OdbcCommand("INSERT INTO picture " +  "(Picture) VALUES (@pic)", cnn);
                cmd.Parameters.Add("@pic", OdbcType.Image, pic.Length).Value = pic;
                cmd.Parameters["@pic"].Value=pic;
                
                //cmd.Parameters.AddWithValue("@pic", pic);
                //cmd.Parameters.Add("@pic", pic);



                string sFileName = System.IO.Path.GetFileName(File1.PostedFile.FileName);
                try
                {
                    if (File1.PostedFile.ContentLength <= lMaxFileSize)
                    {
                        //Save File on disk
                        File1.PostedFile.SaveAs(sFileDir + sFileName);
                        cmd.ExecuteNonQuery();

                        lblMessage.Visible = true;
                        lblMessage.Text = " Uploaded Successfully";
                    }
                    else //reject file
                    {
                        lblMessage.Visible = true;
                        lblMessage.Text = "File Size is Over the Limit of " + lMaxFileSize;
                    }
                }
                catch (Exception)//in case of an error
                {
                    lblMessage.Visible = true;
                    lblMessage.Text = "An Error Occured. Please Try Again!";
                    //DeleteFile(sFileDir + sFileName);
                }
            }
            CloseDatabase();
        }


public void OpenDatabase()
        {
            strConn = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=mysql; User=root;Password=123";
            cnn = new OdbcConnection(strConn);
            cnn.Open();

        }

        public void CloseDatabase()
        {
            cnn.Close();
        }

what I get in the database is NULL value after execute above code, can I know why..
Is there anything wrong ??
Thanks in advance !!

Problem solved !!

I just need to change the "@pic" to "?" ...

OdbcCommand cmd = new OdbcCommand("INSERT INTO picture " + "(Picture) VALUES (@pic)", cnn);

and

//cmd.Parameters.Add("@picture", pic);

This question has already been answered. Start a new discussion instead.