No overload for method 'Forum' takes '1' arguments

I am getting this error - No overload for method 'Forum' takes '1' arguments
Can anyone help?
I am using a web service created by myself
 Topic Page
<asp:HyperLinkField DataNavigateUrlFormatString="~/topic.aspx?TopicID={0}" NavigateUrl="~/topic.aspx" Text="Comments" DataNavigateUrlFields="TopicID" />
Comments Page

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

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

datasource = topic.Forum("SELECT * FROM Comment WHERE TopicID =" +topicId);

GridView1.DataSource = datasource;

GridView1.DataBind();

 

0
JohnnyJ
5/15/2008 3:16:10 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

13 Replies
1023 Views

Similar Articles

[PageSpeed] 39

somewhere in your code youre calling a method that takes either more than 1 parameter in the method or no parameters.


+
Lvl FIVE THOUSAND DRAGON MASTER SOFTWARE ENGINEER
my friends call me MOI
0
moises
5/15/2008 3:23:24 PM

Please check out your Forum webservice method looks like it doesnt take a string parameter.

There is some problem with signature. Make sure to pass your arguments according to what your Forum signature demands.

If this does not solve your problem then please provide your Forum signature in your webservice here.

Hope this helps.

0
Abhishek
5/15/2008 3:25:55 PM
This might be a stupid question but what does Forum signature mean?
0
JohnnyJ
5/15/2008 4:21:49 PM

The topicid is a auto-generated number, would that cause this problem?

0
JohnnyJ
5/15/2008 4:24:36 PM

when you call a method it will have 0 or more parameters those parameters are called the method signature, and what that signature is, is its telling you what it needs to perform that method .... for example if you do

string my = "";

my.ToCharArray();

the first intellesence will show no parameters and the signature would be blank or empty

but if i push down while intelesense is up you will see the signature change to

my.ToCharArray(int startIndex, int Length);

now the signature is                   int  startindex, int length

meaning to run that method you HAVE to give it either nothing OR you have to get it an int, which will represent where to start making this array, and an int which tells the method how long to make the array.....

 

now in your case if youre calling a method and not giving it the proper parameters that its asking for in the signature, then it will throw an error and tell you such, SO in conclusion... try to put a breakpoint at the beginning of your logic and when it breaks or throws an error then you know which method does not have valid params

 

get it? or if you dont ill try to explain more


+
Lvl FIVE THOUSAND DRAGON MASTER SOFTWARE ENGINEER
my friends call me MOI
0
moises
5/15/2008 4:47:58 PM

if you want to paste your code i can try to figure out which method is nutso


+
Lvl FIVE THOUSAND DRAGON MASTER SOFTWARE ENGINEER
my friends call me MOI
0
moises
5/15/2008 4:48:58 PM

 <xs:element name="ForumID" type="xs:int" minOccurs="0" />

Thats what it states within the web service

0
JohnnyJ
5/15/2008 5:51:32 PM

Hi Johnny

A signature means what your method looks like its returntype & parameters.

I think you are passing an integer, this is what your last post suggests.

Make the following changes & you will be good:

Change No.1
//topic.Forum should only pass topicId as parameter

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

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

datasource = topic.Forum(topicId);

GridView1.DataSource = datasource;

GridView1.DataBind();


Change No.2
//Change your Forum parameter to take string

Forum(sting topicId)
{
//write your code to fire the query
//SELECT * FROM Comment WHERE TopicID =" +topicId
}

Hope this helps.

Thanks

Abhishek 

 

0
Abhishek
5/15/2008 6:40:38 PM

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

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

datasource = topic.Forum(topicId);

GridView1.DataSource = datasource;

GridView1.DataBind();

This is the new code. I dont understand where this goes:

Forum(sting topicId)
{
//write your code to fire the query
//SELECT * FROM Comment WHERE TopicID =" +topicId
}

0
JohnnyJ
5/15/2008 7:09:23 PM

Hi

This code goes into your Forum webservice method. You take the topicId as string & then issue a query for the database.

 

0
Abhishek
5/16/2008 6:42:57 AM

[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

0
JohnnyJ
5/16/2008 12:41:10 PM

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();

This code is within the pageload within a try and catch statement. When I added the public dataset I got alot of errors. Have I put it in the wrong place?

0
JohnnyJ
5/17/2008 8:17:35 AM

Hi johnny,

       Your GetDataSetForum2 method is almost completely a disaster. As I can see you have totally no idea of the C# basis. I strongly recommand you to learn this language first, and then turn back here to ask a more specific question.

For the method I can help you do some corrections here:

public DataSet GetDataSetForum2(string id)

{

SqlConnection conn =
    new SqlConnection("server=.;uid=sa;pwd=;database=pubs");

    SqlCommand sqlcom=new SqlCommand();

    sqlcom.CommanText="SELECT * FROM Post WHERE ForumID='" + topicId + "'";

    SqlDataAdapter da =
          new SqlDataAdapter(sqlcom,conn);

    DataSet ds = new DataSet();
    da.Fill(ds, "Authors");

     return ds;
}

Regards,

Ivan.

0
Ivan
5/19/2008 9:57:23 AM
Reply:

Similar Artilces:

Web Service
[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"].To...

what does 'No overload for method 'Insert' takes '1' arguments' mean?
code that caused this error: line AddInBookSqlDataSource2.Insert(item);protected void inbookButton_Click(object sender, EventArgs e){ try{ AddInBookSqlDataSource1.Insert(); }catch (Exception ex){ uploadSPoneLabel.Text = "Saved Failed: SP One" + ex.Message; }foreach (ListItem item in authorsListBox5.Items){ try{ AddInBookSqlDataSource2.Insert(item); saveStatusLabel.Text = "Save Successful: SP Two"; }catch (Exception ex1){saveStatusLabel.Text = "Save Failed: SP Two" + ex1.Message; } } } any help appreciated Thanks in advance At a surface leve...

No overload for method 'FormatImagePath' takes '1' arguments
Hi, I am getting the error message above on the code below.  I did not write the code.  I am new to ASP.NET and I had to download Visual Studio 2005 to compile my C# files.  The website was written in a previous version and the error message appeared when I tried compiling after the conversion to ASP.NET 2.0. by Visual Studio.  I don't understand the error message and I am not entirely clear on what the code is doing.  Would anyone be able to help?    <table> <tr><td></td></tr> <tr><...

No overload for method 'FieldValue' takes '1' arguments
Very confused, the recordset returns a record, all is working, but it's just giving me an error?????? anybody knows how to solve this, Compiler Error Message: CS1501: No overload for method 'FieldValue' takes '1' arguments Source Error: Line 19: { Line 20: Line 21: Response.Redirect(ds_redirect.FieldValue("url")); Line 22: } Line 23: ---------------------------- When removing the fieldvalue I receive another error Compiler Error Message: CS0118: 'ASP.frame_redirect_url_aspx.ds_redirect' denotes a 'field' where a 'method' was expected...

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

CS1501: No overload for method 'ToShortDateString' takes '1' arguments
Hello,  I'm quite new in ASP.NET. I'm developing a website for my company where people can request a reservation. Therefor I made a form where there is a Calendar where they can pick a date for their reservation-request. I'd like to make all the dates 'till "today+1" unselectable. I didn't found a way to do this so I use a CompareValidator to check whether the day they selected is "greater than today". Unfortunately I get this errormessage "CS1501: No overload for method 'ToShortDateString' takes '1' arguments" while it is a solution I found on the web. Can someone please help me. Than...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

Error Message: No overload for method 'SqlParameter' takes '1' arguments
Dear All,   I have a problem while trying to update the content of my page to the database by the means of a stored procedure string OcompConnection = ConfigurationManager.ConnectionStrings["GenUserCode"].ConnectionString;  System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(OcompConnection); System.Data.SqlClient.SqlCommand ocmd = new System.Data.SqlClient.SqlCommand("Dealer_Insert", conn);ocmd.CommandType = CommandType.StoredProcedure; ocmd.Parameters.Add(new SqlParameter("@UserCode"), SqlDbType.NVarChar); oc...

Compiler Error Message: CS1501: No overload for method 'ToString' takes '1' arguments
Compiler Error Message: CS1501: No overload for method 'ToString' takes '1' argumentsSource Error: Line 248: //{ Line 249: Line 250: int RollNo = Convert.ToInt32(str.ToString(str.Append(GridView1.Rows[i].Cells[1].Text))); Line 251: Line 252: DeleteStudent(RollNo); Source File: h:\Office Works\Projects\Sample Applications\GridViewVitCode.aspx.cs    Line: 250 Please solve this problem  This is the complete code  protected void Button2_Click(object sender, EventArgs e) {for (int i = 0; i <...

No overload for method 'Add' takes '3' arguments
For some reason, I don't know if maybe I'm just not using the right method for the adding of parameters, but I get this error during the build:No overload for method 'Add' takes '3' arguments            Should I be using Add here?  I did see using dbCommandWrapper.AddInParameter here but I do'nt think that's a valid method in Enterprise Library 2.0: http://aspalliance.com/688Part of my code:....some code beforeDatabase db = DatabaseFactory.CreateDatabase();             DbCommand dbCommandWrapper = db.GetStoredProcCommand("...

No overload for method 'ReportParameter' takes '2' arguments
I am trying to render a report that runs on our remote SQL Reporting Server to the ReportViewer control in my C# asp.net page.  The reports will need to have various parameters past to it.  However, every example I see on how to do this looks something like this (this is from MSDN):ReportParameter p = new ReportParameter("ShowDescriptions", "test");this.ReportViewer1.ServerReport.SetParameters(new ReportParameter[] { p }); However, this will not build for me, I get the error:No overload for method 'ReportParameter' takes '2' argumentsIn fact, when I mouse over ReportParameter,...

No overload for method 'uf_save_dw_as_excel' takes '2' arguments
I'm trying to save my DW using the Dw2xls Powerbuilder Library for converting DW to Excel, when is Generating PowerBuilder .NET assemblies failed. Isn't complain for this version 11.5? Anyone knows how to correct this problem? Thanks to all. are you trying the demo version? It comes with PBD file which cannot be included in a demo WEBFORM applicatiom, just ion a native one. However, the presentation XLS you'll get under PB native would be the same in a webform application. When you buy the product, you'll receive the PBL source of DW2XLS which the could be ...

CS1501: No overload for method 'buildQuery' takes '4' arguments
Hi i get the error "No overload for method 'buildQuery' takes '4' arguments" when i click on the save button which is meant to execute the button, my code is as follows;clsOBJ objDHOC = new clsOBJ();Pmillio.clsOBJ.buildQuery("INSERT", "tblProperty", strData, strWhere); { string[,] strData = new string[11, 2];string[,] strWhere = new string[11, 3]; strData[0, 0] = "StatutoryDate";strData[0, 1] = Convert.ToDateTime(this.txtDate.Text.ToString().Trim()); strData[1, 0] = "DateApplied";strData[1, 1] = Convert.ToDateTime(...

CS1501: No overload for method 'buildQuery' takes '0' arguments
I am getting the following message when i try to execute my code; "CS1501: No overload for method 'buildQuery' takes '0' arguments", where am i going wrong, my code is below;public static DataSet SQLExecute(string strSQL) { string strTableName;string strData; DataSet dsetResponse = new DataSet(); try {using (SqlConnection conn = new SqlConnection(DHOC.clsDHOC.GetConnString())) {SqlCommand cmd = new SqlCommand("SELECT '" + strData + "' FROM '" + strTableName + "' where '" + strData + "' = 'Column...

Web resources about - No overload for method 'Forum' takes '1' arguments - asp.net.web-forms

Resources last updated: 12/16/2015 12:58:57 AM