Web Service - No overload for method 'Forum' takes '1' arguments

Last post 05-17-2008 4:03 AM by JohnnyJ. 3 replies.

Sort Posts:

  • Web Service - No overload for method 'Forum' takes '1' arguments

    05-16-2008, 1:13 PM
    • Loading...
    • JohnnyJ
    • Joined on 01-09-2008, 3:14 AM
    • Posts 71

    [WebMethod]
    public DataSet GetDataSetForum2()
    {
    DataSet datasource = new DataSet();
    string database = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/topic.mdb;Persist Security Info=True";
    string queryStr = "Select * from Comment";
    OleDbConnection myConn = new OleDbConnection(database);
    OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(queryStr, myConn);
    myConn.Open();
    myDataAdapter.Fill(datasource, "Comment");
    myConn.Close();
    return datasource;
    }

    localhost.Topic topic = new localhost.Topic();

    string topicId = Request.QueryString["TopicID"].ToString();

    string id = "SELECT * FROM Post WHERE ForumID='" + topicId + "'";

    datasource = topic.GetDataSetForum2(id);

    GridView1.DataSource = datasource;

    GridView1.DataBind();

    topicid is a int not a string if that makes any difference.

    So does a query string need to be within the webservice? I have noticed that there are two querystrings,however if I remove the querystring from the web service it doesnt display anything, as its not querying the table I think? I added the querystring which is located within the website however it stated that the topicid could not be found, so I added that but then it didnt like the response statement.

    Thank you for your help

  • Re: Web Service - No overload for method 'Forum' takes '1' arguments

    05-16-2008, 3:51 PM

    You are calling yout web method passing the id, but in your web method does not takes in any parameters. Check your web method GetDataSetForum2 definition.

    datasource = topic.GetDataSetForum2(id);

    ~ Remember To Mark The Post(s) That Helped You As The ANSWER ~
  • Re: Web Service - No overload for method 'Forum' takes '1' arguments

    05-16-2008, 4:11 PM
    Answer
    • Loading...
    • vinz
    • Joined on 10-05-2007, 11:47 AM
    • Cebu Philippines
    • Posts 7,377

    I noticed that you method GetDataSetForum2() doesn't have any paramters set to it but you are assigning a parameter in your codes which is the id... so remove the id your code like

    datasource = topic.GetDataSetForum2(id);

    and replace with

    datasource = topic.GetDataSetForum2();

    But if you need to pass the id in the method then change you method to this

    public DataSet GetDataSetForum2(string id)
    {

    //Your Logic goes here 

     

     

    Cheers,
    Vincent Maverick Durano

    "Life is like music; it must be composed by ear, feeling, and instinct, not by rule..."

  • Re: Web Service - No overload for method 'Forum' takes '1' arguments

    05-17-2008, 4:03 AM
    Answer
    • Loading...
    • JohnnyJ
    • Joined on 01-09-2008, 3:14 AM
    • Posts 71

     

    try
    {
       localhost.Topic topic = new localhost.Topic(); 
       string topicId = Request.QueryString["TopicID"].ToString(); 
       public DataSet GetDataSetForum2(string id) 
       {
    
       "SELECT * FROM Post WHERE ForumID='" + topicId + "'";
    
       }  
    
       datasource = topic.GetDataSetForum2(id); 
       GridView1.DataSource = datasource; 
       GridView1.DataBind(); 
    }
    catch
    {}
    
    This is correct, when I tried it I got loads of errors. Also this coding is located within the pageload.
    
    
    
    
Page 1 of 1 (4 items)
Microsoft Communities
Page view counter