Hi guys
i'm using ASP.net ans SQL server 2005 with stored procedure to do simple search from a table in database.Plz help me out
The error i get Function or procedure expects @searchKey which was not supplied.
protected void btnSearch_Click(object sender, EventArgs e)
{
string constring = ConfigurationManager.AppSettings.Get("con").ToString();
SqlConnection conn = new SqlConnection(constring);
conn.Open();
SqlCommand check = new SqlCommand("spSearch", conn);
check.CommandType = CommandType.StoredProcedure;
check.Parameters.Add(new SqlParameter("@searchKey", SqlDbType.NVarChar,50));
check.Parameters["@searchKey"].Value = txtSearch.Text.Trim();
SqlDataAdapter da = new SqlDataAdapter("spSearch", conn);
DataSet ds = new DataSet();
da.Fill(ds);
dgv1.DataSource = ds;
dgv1.DataBind();
}
Stored Procedure
ALTER proc [dbo].[spSearch](@searchKey nvarchar(50)) as
select * from CD_details where CD_NAME like '%@searchKey%'