473,472 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

convert error?

Dear reader,

In my code I get the following error:

AddComment.cs(32): The best overloaded method match for
'WebLogger.Message.SelectMessage(string, out string, out string)' has some
invalid arguments

This is the code:
class Message
{
...
public int SelectMessage(string pID, out string pTitle, out string
pAddedDate)
{
...
}
}

class AddComment
{
...
public void InsertComment(int pMessageID, string pAuthor, string pEmail,
string pComment)
{
string msgTitle, msgAddedDate;
Message msg = new Message();
msg.SelectMessage(pMessageID, out msgTitle, out msgAddedDate);
}
}

Does anybody have an idea?
I'm quite new to C#, so this could easily be something stupid.

Thanks in advance,

Eddy de Boer
Nov 17 '05 #1
3 1151
eddy de boer wrote:
Dear reader,

In my code I get the following error:

AddComment.cs(32): The best overloaded method match for
'WebLogger.Message.SelectMessage(string, out string, out string)' has some
invalid arguments

This is the code:
class Message
{
...
public int SelectMessage(string pID, out string pTitle, out string
pAddedDate)
{
...
}
}

class AddComment
{
...
public void InsertComment(int pMessageID, string pAuthor, string pEmail,
string pComment)
{
string msgTitle, msgAddedDate;
Message msg = new Message();
msg.SelectMessage(pMessageID, out msgTitle, out msgAddedDate);
}
}

Does anybody have an idea?
I'm quite new to C#, so this could easily be something stupid.


SelectMessage requires a string as the first parameter, you are trying to
pass in int (pMessageID). You need to convert that int to a string first,
easily done by using pMessageID.ToString().
--
Tom Porterfield
Nov 17 '05 #2
Hi,

InsertComment uses

int pMessageID

but SelectMessage uses

string pID

Either change SelectMessage to use int pID, or use pMessage.ToString() when calling SelectMessage

On Tue, 24 May 2005 14:34:06 +0200, eddy de boer <eddy de <bo**@discussions.microsoft.com>> wrote:
Dear reader,

In my code I get the following error:

AddComment.cs(32): The best overloaded method match for
'WebLogger.Message.SelectMessage(string, out string, out string)' has some
invalid arguments

This is the code:
class Message
{
...
public int SelectMessage(string pID, out string pTitle, out string
pAddedDate)
{
...
}
}

class AddComment
{
...
public void InsertComment(int pMessageID, string pAuthor, string pEmail,
string pComment)
{
string msgTitle, msgAddedDate;
Message msg = new Message();
msg.SelectMessage(pMessageID, out msgTitle, out msgAddedDate);
}
}

Does anybody have an idea?
I'm quite new to C#, so this could easily be something stupid.

Thanks in advance,

Eddy de Boer


--
Happy coding!
Morten Wennevik [C# MVP]
Nov 17 '05 #3
<=?Utf-8?B?ZWRkeSBkZSBib2Vy?= <eddy de
bo**@discussions.microsoft.com>> wrote:
In my code I get the following error:

AddComment.cs(32): The best overloaded method match for
'WebLogger.Message.SelectMessage(string, out string, out string)' has some
invalid arguments


Well, pMessageID is an int, and you're trying to pass it in as a
string. What do you want to do with it? You could call ToString() on
pMessageID if you want:

msg.SelectMessage(pMessageID.ToString(),
out msgTitle,
out msgAddedDate);
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Peter Kwan | last post by:
Hi, I believe I have discovered a bug in Python 2.3. Could anyone suggest a get around? When I tested my existing Python code with the newly released Python 2.3, I get the following warning: ...
19
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below....
5
by: Cally | last post by:
Hello, I would like to convert a field from ntext field found in one database table to float field found in another database table. The reason why I want to do this is a long one. I have...
3
by: ET | last post by:
I don't know whats the problem, but after I added functions to first verify, then relink linked tables if not found, now I can't convert that database to MDE format. I can split the database, but...
7
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done...
5
by: simon | last post by:
I have datetime variable: Datetime tsEndTime; Should I use (DateTime): tsEndTime=(DateTime)rdr.GetValue(15) or is better to use: tsEndTime=Convert.ToDateTime(rdr.GetValue(15))
2
by: fabrice | last post by:
Hello I'm getting an error during a .vb file compilation. My command is : vbc /t:library /r:system.web.dll /r:system.dll /r:mscorlib.dll myFile.vb The error is :
12
by: GRoll35 | last post by:
I get 4 of those errors. in the same spot. I'll show my parent class, child class, and my driver. All that is suppose to happen is the user enters data and it uses parent/child class to display...
14
by: Me | last post by:
Hi all I am getting a really bizzare error on when I convert a string into a datetime: The code is : DateTime dt1 = Convert.ToDateTime("10 Sep 2005"); Console.WriteLine(dt1.Year);
10
by: dorkrawk | last post by:
I am having an issue with some VC++ I am writing. I have a struct and I'm trying to call a function from it from a function in another object. here is the struct.... struct JNI_Interface {...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.