コード例 #1
0
ファイル: NewsSearch.aspx.cs プロジェクト: ghglavan/daw
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack && Request.Params["q"] != null)
        {
            string query = Server.UrlDecode(Request.Params["q"]);

            SDSSearch.SelectCommand = "SELECT * FROM News_v"
                                      + " WHERE title LIKE @q";

            SDSSearch.SelectParameters.Clear();
            SDSSearch.SelectParameters.Add("q", "%" + query + "%");
            SDSSearch.DataBind();
        }
        else if (!Page.IsPostBack && Request.Params["cat"] != null)
        {
            string query = Server.UrlDecode(Request.Params["cat"]);

            SDSSearch.SelectCommand = "SELECT * FROM News_v"
                                      + " WHERE category LIKE @q";

            SDSSearch.SelectParameters.Clear();
            SDSSearch.SelectParameters.Add("q", query);
            SDSSearch.DataBind();
        }
    }
コード例 #2
0
ファイル: ArticleSearch.aspx.cs プロジェクト: joahn3/fmi
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack && Request.Params["q"] != null)
        {
            string query = Server.UrlDecode(Request.Params["q"]);

            SDSSearch.SelectCommand = "SELECT Article.Id, Article.Title, Article.Text, Article.Date, Category.CategoryName FROM Category INNER JOIN Article ON Category.Id = Article.IdCategory" + " WHERE Title LIKE @q OR Text LIKE @q";

            SDSSearch.SelectParameters.Clear();
            SDSSearch.SelectParameters.Add("q", "%" + query + "%");
            SDSSearch.DataBind();
        }
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack && Request.Params["q"] != null)
        {
            string query = Server.UrlDecode(Request.Params["q"]);

            SDSSearch.SelectCommand = "SELECT Cars.Id, Cars.Model, Cars.Max_Speed, Cars.Power, Cars.Color, Cars.fabrication_Date, Brands.Name FROM Brands INNER JOIN Cars ON Brands.Id = Cars.brand_id"
                                      + " WHERE Name LIKE @q OR Model LIKE @q";

            SDSSearch.SelectParameters.Clear();
            SDSSearch.SelectParameters.Add("q", query + "%");
            SDSSearch.DataBind();
        }
    }
コード例 #4
0
ファイル: CarSearch.aspx.cs プロジェクト: micmob/fmi
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack && Request.Params["q"] != null)
        {
            string query = Server.UrlDecode(Request.Params["q"]);

            SDSSearch.SelectCommand = "SELECT Car.Id, Car.Model, Car.MaxSpeed, Car.Power, Car.Color, Car.FDate, Brand.BrandName FROM Brand INNER JOIN Car ON Brand.Id = Car.IdBrand"
                                      + " WHERE BrandName LIKE @q OR Model LIKE @q";

            SDSSearch.SelectParameters.Clear();
            SDSSearch.SelectParameters.Add("q", "%" + query + "%");
            SDSSearch.DataBind();
        }
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack && Request.Params["q"] != null)
        {
            string query = Server.UrlDecode(Request.Params["q"]);

            SDSSearch.SelectCommand = "SELECT Id, Gen_stire, Titlu, Descriere, Autor, Data, Imagine, Catchphrase from Stiri"
                                      + " WHERE Titlu LIKE @q or Descriere LIKE @q or Catchphrase like @q order by data desc";

            SDSSearch.SelectParameters.Clear();
            SDSSearch.SelectParameters.Add("q", "%" + query + "%");
            SDSSearch.DataBind();
        }
    }
コード例 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack && Request.Params["q"] != null)
        {
            string query = Server.UrlDecode(Request.Params["q"]);

            SDSSearch.SelectCommand = "SELECT Article.Id, Article.Name, Article.Description, Article.Weight, Article.Height, Domain.DomainName FROM Domain INNER JOIN Article ON Domain.Id = Article.IdDomain"
                                      + " WHERE DomainName LIKE @q OR Name LIKE @q";

            SDSSearch.SelectParameters.Clear();
            SDSSearch.SelectParameters.Add("q", "%" + query + "%");
            SDSSearch.DataBind();
        }
    }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack && Request.Params["q"] != null)
        {
            string query = Server.UrlDecode(Request.Params["q"]);

            SDSSearch.SelectCommand = "SELECT title, Forum.forumId, question, Forum.postername, datetime, answer " +
                                      "FROM Title INNER JOIN Forum ON Title.titleID = Forum.titleId " +
                                      "FULL JOIN Thread ON Forum.forumId = Thread.forumId " +
                                      "WHERE question LIKE @q OR answer LIKE @q";

            SDSSearch.SelectParameters.Clear();
            SDSSearch.SelectParameters.Add("q", "%" + query + "%");
            SDSSearch.DataBind();
        }
    }