Hi,
I facing problem with retrieving data while executing the Stored Procedure.
When I execute the Stored Procedure in the DataBase, I can able to retrieve the correct data. But when I am passing the same values from the web page I can't able to view the same data.
This is the code i am using.
public DataSet InspectionSeach(int cc,string _nameest, string _estadd,string _date_rece)
{
SqlConnection conn = OpenConnection();
DataSet dset = new DataSet();
try
{
SqlCommand cmd = new SqlCommand("sp_InspectionSearch", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@CCnumber", SqlDbType.Int).Value = cc;
cmd.Parameters.Add("@nameest", SqlDbType.VarChar).Value = _nameest;
cmd.Parameters.Add("@addest", SqlDbType.VarChar).Value = _estadd;
cmd.Parameters.Add("@daterec", SqlDbType.VarChar).Value = _date_rece;
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dset);
}
catch
{
}
conn.Close();
return dset;
}
DataSet ds = objDB.InspectionSeach(ccno, txtEstLicNo.Text, txtAddress.Text, txtDate0.Text);
try
{
this.gdvwViolation.DataSource = ds;
this.gdvwViolation.DataBind();
}
catch
{
}
Stored Procedure:Alter Procedure[sp_InspectionSearch]
@CCnumber int,
@nameest Varchar (255),
@addest Varchar (255),
@daterec Varchar (50)
AS
if @nameest is not null and len(@nameest)=0 set @nameest=null
select ccno , name_est, add_est,date_rec, Inspection from tblRequestGen
where ccno like isnull(@CCnumber,0) or add_est like isnull(@addest,0) or name_est like isnull(@nameest,0) or date_rec like isnull(@daterec,0)
union all
select ccno , name_est, add_est,date_rec, Inspection from tblInspReq
where ccno like isnull(@CCnumber,0) or add_est like isnull(@addest,0) or name_est like isnull(@nameest,0) or date_rec like isnull(@daterec,0)
Please help me, its urgent.
Thanks in advance. :)