Jump to content

pulling some int values from a MySQL database using c# and MySqlDataReader I have tried to int.Parse but I get the error cannot convert 'object' to 'string'. any help?

 

 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/488485-dataread-to-int/
Share on other sites

Link to post
Share on other sites

It would probably be best to show some of the code you are using / have a problem with.

 

 

In this case, Int32.Parse(string s) expects a string to get handed in.

What is the object type of the response you are getting?

Maybe casting it to a 

(string)result// OR(int)result

, running a 

result.ToString()// ORresult[0].ToString()

 Method or in case of a DataTable iterating over each line first might do the trick.

 

There might be a 

myMySqlDataReader.GetInt32();

Method aswell.

Link to comment
https://linustechtips.com/topic/488485-dataread-to-int/#findComment-6560349
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×