The below if statement is not working very well, as if the intoo Querystring is working well if the intoo has value "no" but in case if its has values "Ads" or "Business Directory" or "Jobs" then its not working as its move to the last if statement. I have create a screen record that will explain more of the case please check it
https://www.youtube.com/watch?v=fTKfMX8KDcg&feature=youtu.be
if (!IsPostBack)
{
if (cookie != null)
{
if (intoo == "Ads")
{
if (Request.QueryString["Searchfor"] != null)
{
using (SqlConnection srcadshsql = new SqlConnection(sc))
{
srcadshsql.Open();
SqlDataAdapter DAsearchads = new SqlDataAdapter(@"SELECT [AdsID], [AdsDate], [AdsPrice], [AdsTit], SUBSTRING([AdsDesc],1,50) as AdsDesc,
[Section], [Category], [Wtags], [Country],
[State], [City],[Img1] FROM [ads] WHERE (([Country] = @Country) AND ([Wtags] = @Wtags))", sc);
DataSet DSsrchads = new DataSet();
DAsearchads.SelectCommand.Parameters.AddWithValue("@Country", cookie.Value);
DAsearchads.SelectCommand.Parameters.AddWithValue("@Wtags", result);
DAsearchads.Fill(DSsrchads);
resultshowlistview.DataSource = DSsrchads.Tables[0];
resultshowlistview.DataBind();
SrchMultiView.ActiveViewIndex = 0;
}
}
else
{
}
}
if (intoo == "Business Directory")
{
if (Request.QueryString["Searchfor"] != null)
{
using (SqlConnection srcbizhsql = new SqlConnection(sc))
{
srcbizhsql.Open();
SqlDataAdapter DAsearchbiz = new SqlDataAdapter(@"SELECT UID, Country, State, City,
Logo, Website, UsrType, BizCateg, BizSubCateg, Twitter, GooglePlus,Facebook, CompNme, SUBSTRING([CompDesc],1,40) as CompDesc From UserInfo where Country = @Location and UsrType = 'Business' ", sc);
DataSet DSsrchBiz = new DataSet();
DAsearchbiz.SelectCommand.Parameters.AddWithValue("@Location", cookie.Value);
DAsearchbiz.SelectCommand.Parameters.AddWithValue("@Wtags", result);
DAsearchbiz.Fill(DSsrchBiz);
SrchbizHomLstviw.DataSource = DSsrchBiz.Tables[0];
SrchbizHomLstviw.DataBind();
SrchMultiView.ActiveViewIndex = 1;
}
}
}
if (intoo == "Jobs")
{
if (Request.QueryString["Searchfor"] != null)
{
using (SqlConnection srcJobhsql = new SqlConnection(sc))
{
srcJobhsql.Open();
SqlDataAdapter DAsearchJob = new SqlDataAdapter(@"SELECT [JobNum], [Dept], [PubDate], [EndDate], [Employer],
[VacCountry], [VacState], [VacCity], [Jobtitle], [CompLogo], [Wtag], SUBSTRING([jobdesc],1,40) as jobdesc
FROM [jobs] WHERE VacCountry = @Location and CHARINDEX(@Wtags, Wtag)>0 ORDER BY [PubDate] DESC", sc);
DataSet DSsrchJob = new DataSet();
DAsearchJob.SelectCommand.Parameters.AddWithValue("@Location", cookie.Value);
DAsearchJob.SelectCommand.Parameters.AddWithValue("@Wtags", result);
DAsearchJob.Fill(DSsrchJob);
SrchJoblistview.DataSource = DSsrchJob.Tables[0];
SrchJoblistview.DataBind();
SrchMultiView.ActiveViewIndex = 2;
}
}
}
if (intoo == "no")
{
if (Request.QueryString["Searchfor"] == null)
{
using (SqlConnection srcadshsql = new SqlConnection(sc))
{
srcadshsql.Open();
SqlDataAdapter DAsearchads = new SqlDataAdapter(@"SELECT [AdsID], [AdsDate], [AdsPrice], [AdsTit], SUBSTRING([AdsDesc],1,50) as AdsDesc,
[Section], [Category], [Wtags], [Country],
[State], [City],[Img1] FROM [ads] WHERE (([Country] = @Country) AND ([Wtags] = @Wtags))", sc);
DataSet DSsrchads = new DataSet();
DAsearchads.SelectCommand.Parameters.AddWithValue("@Country", cookie.Value);
DAsearchads.SelectCommand.Parameters.AddWithValue("@Wtags", result);
DAsearchads.Fill(DSsrchads);
resultshowlistview.DataSource = DSsrchads.Tables[0];
resultshowlistview.DataBind();
SrchMultiView.ActiveViewIndex = 0;
}
}
}
else
{
}
}
}
Aucun commentaire:
Enregistrer un commentaire