Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
namespace shop
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
        protected void Button1_Click(object sender, EventArgs e)
         {
             onflbload(sender, e);
         }
        public void onflbload(object sender, EventArgs e)
        {
        // Create a byte[] from the input file
        int len = flbload.PostedFile.ContentLength;
        byte[] pic = new byte[len];
        flbload.PostedFile.InputStream.Read(pic, 0, len);
        
        // Insert the image and comment into the database
        SqlConnection connection = new SqlConnection(@"Data Source=DEVI\SQLEXPRESS; 
                          Initial Catalog =cat; Integrated Security=SSPI");
        SqlConnection con = new SqlConnection();
        con.ConnectionString = @"Data Source=DEVI\SQLEXPRESS; Initial Catalog =cat; Integrated Security=SSPI";
        try
        {
            connection.Open();
            SqlCommand cmd = new SqlCommand("insert into tblphotosettings " + "(BillNo,CustomerName,Address,StartDate,EndDate,Numberofcopies,Amount,Total ) values (@BillNo,@CustomerName,@Address,@StartDate,@EndDate,@Numberofcopies,@Amount,@Total)", connection);
            cmd.Parameters.Add("@BillNo", SqlDbType.NVarChar).Value = TextBox1.Text;
            cmd.Parameters.Add("@CustomerName", SqlDbType.NVarChar).Value =TextBox2.Text;
            cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value = TextBox3.Text;
            cmd.Parameters.Add("@StartDate", SqlDbType.NVarChar).Value =Rdbsdate.SelectedDate;
            cmd.Parameters.Add("@EndDate", SqlDbType.NVarChar).Value =Rdbddate.SelectedDate;
            
            cmd.Parameters.Add("@Numberofcopies", SqlDbType.NVarChar).Value =TextBox7.Text;
            cmd.Parameters.Add("@Amount", SqlDbType.NVarChar).Value = TextBox8.Text;
            cmd.Parameters.Add("@Total", SqlDbType.NVarChar).Value = TextBox9.Text;
           
            
            cmd.CommandText = "photosets";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Connection = con;
            cmd.Parameters.Add("@Systemurl", SqlDbType.Image).Value = pic;
            SqlParameter Src = new SqlParameter("@FilePath", SqlDbType.VarChar, 450);
            
            cmd.Parameters.Add(Src);
            con.Open();
            cmd.ExecuteNonQuery();
        }
        finally
        {
            connection.Close();
        }
    }
}
}
<pre lang="sql">set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[photosets]
(
@Systemurl image,
@Filepath varchar
)

AS
BEGIN
    insert into tblphotosettings
(

Systemurl,
Filepath
)
    values
(
@Systemurl,
@Filepath
)
END



My Error Procedure or function photosets has too many arguments specified.specified.
Posted
Updated 6-Apr-11 1:01am
v2
Comments
Pravin Patil, Mumbai 6-Apr-11 7:22am    
What do you want..?

1 solution

Make sure your stored procedure takes two arguments.
 
Share this answer
 
Comments
kannan 2 6-Apr-11 7:03am    
i update my store procedure
Pravin Patil, Mumbai 6-Apr-11 7:22am    
Hi Abhinav....Did you get OP's question...?
What does he want exactly..?
kannan 2 6-Apr-11 7:40am    
i want store imag and customer record and image file name (Example photo.jpg)

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