Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,105 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,700 people online right now. Registration is fast and FREE... Join Now!




Convert int to String

 
Reply to this topicStart new topic

Convert int to String

dmxxmd
28 Nov, 2007 - 01:19 AM
Post #1

New D.I.C Head
*

Joined: 25 Oct, 2007
Posts: 25



Thanked: 1 times
My Contributions
Hi guys Im trying to convert int to string but it gives me a error (Cannot convert method group 'ToString' to non-delegate type 'int'. Did you intend to invoke the method?)
I dont know how to use int.parse( ); on it...
Dont know what Im doing wrong Im working with stored procedures...If you can help me I will appreciate it...thanx

CODE

try
            {
                reader = command.ExecuteReader(CommandBehavior.CloseConnection);

                while (reader.Read())
                {
                    //line error occurrs on
                      users.RoleId = reader["int_RoleId"].ToString;                  
                }

                reader.Close();


Edit: Please use code tags for your code smile.gif Like so ==> code.gif

This post has been edited by PsychoCoder: 28 Nov, 2007 - 04:51 AM
User is offlineProfile CardPM
+Quote Post

baavgai
RE: Convert Int To String
28 Nov, 2007 - 04:02 AM
Post #2

Dreaming Coder
Group Icon

Joined: 16 Oct, 2007
Posts: 2,019



Thanked: 105 times
Dream Kudos: 475
Expert In: C, C++, Java, C#, ASP.NET, PHP, Perl, Python, Oracle, SQL Server, MySql, HTML, JavaScript, Lua

My Contributions
The result of reader["int_RoleId"] should actually be an object.

The line also needs to be a method call, not a property, which is probably the problem. Try reader["int_RoleId"].ToString();. If it's still strange, there's also Convert.ToString, but it should be the same thing.

Also, check for null, just in case.

Hope this helps.

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 09:08PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month