doubt about namespace google

Discussion in 'ASP .Net' started by manasa sreenivas via .NET 247, May 15, 2004.

  1. Respected Sir ,
    while compiling c sharp code, getting an error as google namespace is not found.

    please send me the solution for this as soon as possible.

    Code :

    using System.IO;
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using System.Resources;
    using System.Threading;

    namespace AGS
    {
    /// <summary>
    /// Summary description for WebForm1.
    /// </summary>
    public class WebForm1 : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.Button Button1;
    protected System.Web.UI.WebControls.Label Label4;
    protected System.Web.UI.WebControls.DropDownList DropDownDisplay;
    protected System.Web.UI.WebControls.TextBox SearchBox;
    protected System.Web.UI.WebControls.Label Label2;
    protected System.Web.UI.WebControls.Label Label3;
    protected System.Web.UI.WebControls.Label Label5;
    protected System.Web.UI.WebControls.Label Label6;
    protected System.Web.UI.WebControls.Label Label7;
    protected System.Web.UI.WebControls.Label Label8;
    protected System.Web.UI.WebControls.Label Label9;
    protected System.Web.UI.WebControls.Label Label10;
    protected System.Web.UI.WebControls.Label Label11;
    protected System.Web.UI.WebControls.Label Label12;
    protected System.Web.UI.WebControls.Label Label13;
    protected System.Web.UI.WebControls.DataList DataList1;
    protected System.Web.UI.WebControls.Label Label1;

    private void Page_Load(object sender, System.EventArgs e)
    {
    Label1.Visible=false;
    if (!Page.IsPostBack)
    {
    DropDownDisplay.Items.Add("Broad Match");
    DropDownDisplay.Items.Add("Phrase Match");
    DropDownDisplay.Items.Add("Exact Match");
    DropDownDisplay.Items.Add("Negative Match");
    }

    // Put user code to initialize the page here
    }

    #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
    this.Button1.Click += new System.EventHandler(this.Button1_Click);
    this.DataList1.ItemCreated += new System.Web.UI.WebControls.DataListItemEventHandler(this.DataList1_ItemCreated);
    this.DataList1.ItemCommand += new System.Web.UI.WebControls.DataListCommandEventHandler(this.DataList1_ItemCommand);
    this.DataList1.UpdateCommand += new System.Web.UI.WebControls.DataListCommandEventHandler(this.DataList1_UpdateCommand);
    this.DataList1.ItemDataBound += new System.Web.UI.WebControls.DataListItemEventHandler(this.DataList1_ItemDataBound);
    this.DataList1.SelectedIndexChanged += new System.EventHandler(this.DataList1_SelectedIndexChanged);
    this.Load += new System.EventHandler(this.Page_Load);

    }
    #endregion



    private void Button1_Click(object sender, System.EventArgs e)
    {

    string Broad = SearchBox.Text;
    string Phrase=" ' " + SearchBox.Text + " ' ";
    string Exact=" [ " + SearchBox.Text + " ] " ;
    string Negative= "red" + SearchBox.Text;
    string LicenseNo="l7QDmvZQFHJW+U9glNGa89dsNZ4LpdpQ";
    //"g5w/xPRQFHJ019W86jdUFrsxpfQB4RNP";
    string OptionSelected;
    if (DropDownDisplay.SelectedItem.Text=="Broad Match")
    OptionSelected=Broad;
    else if (DropDownDisplay.SelectedItem.Text=="Phrase Match")
    OptionSelected=Phrase;
    else if (DropDownDisplay.SelectedItem.Text=="Exact Match")
    OptionSelected=Broad;
    else if (DropDownDisplay.SelectedItem.Text=="Negative Match")
    OptionSelected=Negative;
    DataTable dt=new DataTable();
    DataRow dr;
    dt.Columns.Add((new DataColumn("List",typeof(string))));




    try
    {
    Google.GoogleSearchService s = new Google.GoogleSearchService();
    Google.GoogleSearchResult r = s.doGoogleSearch(LicenseNo, SearchBox.Text,0, 10, false, "", false, "", "", "");
    int Results = r.estimatedTotalResultsCount;
    Label1.Visible=true;
    Label1.Text = "Results Obtained for: " + SearchBox.Text +" are : "+Convert.ToString(Results);
    foreach (Google.ResultElement rs in r.resultElements)
    {
    dr=dt.NewRow();
    dr[0]=rs.URL;
    dt.Rows.Add(dr);

    //DropDownResultDisplay.Items.Add(rs.URL);
    }
    DataList1.DataSource=new DataView(dt);
    DataList1.DataBind();

    }
    catch (System.Web.Services.Protocols.SoapException ex)
    {
    //Response.Redirect(DropDownResultDisplay.SelectedItem.ToString());
    }
    }

    private void DataList1_SelectedIndexChanged(object sender, System.EventArgs e)
    {
    //Response.Redirect(DataList1.DataKeys[DataList1.SelectedIndex].ToString());
    }

    private void DataList1_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
    {
    //Response.Redirect(DataList1.DataKeys[DataList1.SelectedIndex].ToString());
    }

    private void DataList1_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
    {

    }

    private void DataList1_UpdateCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
    {

    }

    private void DataList1_ItemCreated(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
    {

    }
    }

    }

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>21LUl7T6G0G/nxJCLqk7dA==</Id>
    manasa sreenivas via .NET 247, May 15, 2004
    #1
    1. Advertising

  2. manasa sreenivas via .NET 247

    John Young Guest

    Have you referenced the Google assembly (if there is one), or are you
    missing a Using statement?

    --
    ===============================
    try
    {
    Linux (any version)
    }
    catch
    {
    Format (mainHardDisk)
    Install (Windows2000/XP/2003)
    }
    // You know you want to !!!

    John Young
    "manasa sreenivas via .NET 247" <> wrote in message
    news:%...
    > Respected Sir ,
    > while compiling c sharp code, getting an error as google
    > namespace is not found.
    >
    > please send me the solution for this as soon as possible.
    >
    > Code :
    >
    > using System.IO;
    > using System;
    > using System.Collections;
    > using System.ComponentModel;
    > using System.Data;
    > using System.Drawing;
    > using System.Web;
    > using System.Web.SessionState;
    > using System.Web.UI;
    > using System.Web.UI.WebControls;
    > using System.Web.UI.HtmlControls;
    > using System.Resources;
    > using System.Threading;
    >
    > namespace AGS
    > {
    > /// <summary>
    > /// Summary description for WebForm1.
    > /// </summary>
    > public class WebForm1 : System.Web.UI.Page
    > {
    > protected System.Web.UI.WebControls.Button Button1;
    > protected System.Web.UI.WebControls.Label Label4;
    > protected System.Web.UI.WebControls.DropDownList DropDownDisplay;
    > protected System.Web.UI.WebControls.TextBox SearchBox;
    > protected System.Web.UI.WebControls.Label Label2;
    > protected System.Web.UI.WebControls.Label Label3;
    > protected System.Web.UI.WebControls.Label Label5;
    > protected System.Web.UI.WebControls.Label Label6;
    > protected System.Web.UI.WebControls.Label Label7;
    > protected System.Web.UI.WebControls.Label Label8;
    > protected System.Web.UI.WebControls.Label Label9;
    > protected System.Web.UI.WebControls.Label Label10;
    > protected System.Web.UI.WebControls.Label Label11;
    > protected System.Web.UI.WebControls.Label Label12;
    > protected System.Web.UI.WebControls.Label Label13;
    > protected System.Web.UI.WebControls.DataList DataList1;
    > protected System.Web.UI.WebControls.Label Label1;
    >
    > private void Page_Load(object sender, System.EventArgs e)
    > {
    > Label1.Visible=false;
    > if (!Page.IsPostBack)
    > {
    > DropDownDisplay.Items.Add("Broad Match");
    > DropDownDisplay.Items.Add("Phrase Match");
    > DropDownDisplay.Items.Add("Exact Match");
    > DropDownDisplay.Items.Add("Negative Match");
    > }
    >
    > // Put user code to initialize the page here
    > }
    >
    > #region Web Form Designer generated code
    > override protected void OnInit(EventArgs e)
    > {
    > //
    > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    > //
    > InitializeComponent();
    > base.OnInit(e);
    > }
    >
    > /// <summary>
    > /// Required method for Designer support - do not modify
    > /// the contents of this method with the code editor.
    > /// </summary>
    > private void InitializeComponent()
    > {
    > this.Button1.Click += new System.EventHandler(this.Button1_Click);
    > this.DataList1.ItemCreated += new
    > System.Web.UI.WebControls.DataListItemEventHandler(this.DataList1_ItemCreated);
    > this.DataList1.ItemCommand += new
    > System.Web.UI.WebControls.DataListCommandEventHandler(this.DataList1_ItemCommand);
    > this.DataList1.UpdateCommand += new
    > System.Web.UI.WebControls.DataListCommandEventHandler(this.DataList1_UpdateCommand);
    > this.DataList1.ItemDataBound += new
    > System.Web.UI.WebControls.DataListItemEventHandler(this.DataList1_ItemDataBound);
    > this.DataList1.SelectedIndexChanged += new
    > System.EventHandler(this.DataList1_SelectedIndexChanged);
    > this.Load += new System.EventHandler(this.Page_Load);
    >
    > }
    > #endregion
    >
    >
    >
    > private void Button1_Click(object sender, System.EventArgs e)
    > {
    >
    > string Broad = SearchBox.Text;
    > string Phrase=" ' " + SearchBox.Text + " ' ";
    > string Exact=" [ " + SearchBox.Text + " ] " ;
    > string Negative= "red" + SearchBox.Text;
    > string LicenseNo="l7QDmvZQFHJW+U9glNGa89dsNZ4LpdpQ";
    > //"g5w/xPRQFHJ019W86jdUFrsxpfQB4RNP";
    > string OptionSelected;
    > if (DropDownDisplay.SelectedItem.Text=="Broad Match")
    > OptionSelected=Broad;
    > else if (DropDownDisplay.SelectedItem.Text=="Phrase Match")
    > OptionSelected=Phrase;
    > else if (DropDownDisplay.SelectedItem.Text=="Exact Match")
    > OptionSelected=Broad;
    > else if (DropDownDisplay.SelectedItem.Text=="Negative Match")
    > OptionSelected=Negative;
    > DataTable dt=new DataTable();
    > DataRow dr;
    > dt.Columns.Add((new DataColumn("List",typeof(string))));
    >
    >
    >
    >
    > try
    > {
    > Google.GoogleSearchService s = new Google.GoogleSearchService();
    > Google.GoogleSearchResult r = s.doGoogleSearch(LicenseNo,
    > SearchBox.Text,0, 10, false, "", false, "", "", "");
    > int Results = r.estimatedTotalResultsCount;
    > Label1.Visible=true;
    > Label1.Text = "Results Obtained for: " + SearchBox.Text +" are :
    > "+Convert.ToString(Results);
    > foreach (Google.ResultElement rs in r.resultElements)
    > {
    > dr=dt.NewRow();
    > dr[0]=rs.URL;
    > dt.Rows.Add(dr);
    >
    > //DropDownResultDisplay.Items.Add(rs.URL);
    > }
    > DataList1.DataSource=new DataView(dt);
    > DataList1.DataBind();
    >
    > }
    > catch (System.Web.Services.Protocols.SoapException ex)
    > {
    > //Response.Redirect(DropDownResultDisplay.SelectedItem.ToString());
    > }
    > }
    >
    > private void DataList1_SelectedIndexChanged(object sender,
    > System.EventArgs e)
    > {
    > //Response.Redirect(DataList1.DataKeys[DataList1.SelectedIndex].ToString());
    > }
    >
    > private void DataList1_ItemDataBound(object sender,
    > System.Web.UI.WebControls.DataListItemEventArgs e)
    > {
    > //Response.Redirect(DataList1.DataKeys[DataList1.SelectedIndex].ToString());
    > }
    >
    > private void DataList1_ItemCommand(object source,
    > System.Web.UI.WebControls.DataListCommandEventArgs e)
    > {
    >
    > }
    >
    > private void DataList1_UpdateCommand(object source,
    > System.Web.UI.WebControls.DataListCommandEventArgs e)
    > {
    >
    > }
    >
    > private void DataList1_ItemCreated(object sender,
    > System.Web.UI.WebControls.DataListItemEventArgs e)
    > {
    >
    > }
    > }
    >
    > }
    >
    > -----------------------
    > Posted by a user from .NET 247 (http://www.dotnet247.com/)
    >
    > <Id>21LUl7T6G0G/nxJCLqk7dA==</Id>
    John Young, May 15, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bob Nelson

    doubt about doubt

    Bob Nelson, Jul 28, 2006, in forum: C Programming
    Replies:
    11
    Views:
    623
  2. namespace doubt

    , Aug 6, 2006, in forum: C++
    Replies:
    2
    Views:
    288
    Frederick Gotham
    Aug 6, 2006
  3. Replies:
    0
    Views:
    559
  4. Peter Otten
    Replies:
    2
    Views:
    111
    Cousin Stanley
    Aug 10, 2013
  5. Terry Reedy
    Replies:
    0
    Views:
    115
    Terry Reedy
    Aug 10, 2013
Loading...

Share This Page