jeudi 13 août 2015

getting error -Procedure or function 'sp_InsertContentForhomepage' expects parameter '@company', which was not supplied

getting error - getting error -Procedure or function 'sp_InsertContentForhomepage' expects parameter '@company', which was not supplied.

im trying to insert two values ...im new in using sp .

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ShoppingConnectionString"].ConnectionString);
            con.Open();
            string text = FCKeditor.Value;
            string company = txtCompany.Text.Trim();
            DataSet ds = new DataSet();

            SqlCommand cmd = new SqlCommand("sp_InsertContentForhomepage", con);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue(@text, text);
             cmd.Parameters.AddWithValue(@company,company);

            cmd.ExecuteNonQuery();
            con.Close();

my strode procedure

 create PROCEDURE sp_InsertContentForhomepage
   @company    VARCHAR(50),
    @text  VARCHAR(max)

AS
BEGIN

INSERT INTO tbl_HomepageContent (company, text)
VALUES (@company,@text)

END



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire