Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error in trying to implicitly convert type 'Object' to 'Int'
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Error in trying to implicitly convert type 'Object' to 'Int'
Divers
Thread ID:
00979853
Message ID:
00979853
Vues:
40
Hi.
I am trying to read a record form a table, and display the contents of one field. (There is only one row in the table..coming from a dataset)
The field is type numeric.

My code is:
DataTable dt = this.dsIFNUM.Tables["IFNUM"];

// Go to the first record on the table
DataRow dr = dt.Rows[0];

// Store field contents to a variable
int MyNum;
MyNum = dr["num_nexta"];
MessageBox.Show(Convert.ToString(MyNum));
I am getting a 'Cannot Implicitly convert type 'Object' to 'Int'
on the MyNum = dr["num_nexta"] line
I am trying to store the value of the num_nexta field into Mynum field
and then display the contents

Any help appreciated.

Regards,
Gerard





Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform