hi.. try this
Stored proc
====
create proc sp_SearchByCountry
@CountryName varchar(50)
as
begin
select * from Persons where PersonCountry=@CountryName
end
.cs
===
buttonSearch_click()
{
string country=txtCountry.text;
sqlconnection cnn=new sqlconnection("get connectionstring here");
sqlcommand cmd=new sqlcommand("sp_SearchByCountry",cnn);
cmd.commandtype=commandtype.storedprocedure;
cmd.parameters.addwithvalue("@country",PersonCountry);
sqldatadapter ada=new sqldataadapter(cmd);
dataset ds=new dataset();
gridperson.datasource=ds;
gridperson.databind();
}
Join Hands Change lives
Thanks & Regards
Straight Edge Society
Ankit_parmar555, if this helps please login to Mark As Answer. | Alert Moderator