List Info

Thread: C-Sharp (C#) Group: Assigning Database Field Data




C-Sharp (C#) Group: Assigning Database Field Data
user name
2006-09-05 21:01:26

I know this is probably a stupid question.

 

da is a dataadapter of course.  My questin is if field cs-xref-nbr is an integer field in the database and nCustomerNumber is an integer then why do I have to cast it in order to assign the field data to the variable.

 

This works:

 

da.Fill(ds, "mytable");

DataRow r = ds.Tables["mytable"].Rows[0];

this.nCustomerNumber = (int)r["cs-xref-nbr"];

 

 

 

This does not:

 

da.Fill(ds, "mytable");

DataRow r = ds.Tables["mytable"].Rows[0];

this.nCustomerNumber = r["cs-xref-nbr"];

 

 

 

Thanks,

 

 

 

Jeremy Schreckhise, M.B.A.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )