Link to home
Start Free TrialLog in
Avatar of Jimbo99999
Jimbo99999Flag for United States of America

asked on

VB.Net - Referencing Decimal Type in DataTable

Good Day Experts!

I am iterating through a DataTable referencing values in it for a select query.

Here is the portion of the select query where sqlRSGetLineItems is the DataRow in the below For Each loop:

[BATCH NUMBER]='" & sqlRSGetLineItems("BATCH NUMBER").Value & "''

For Each sqlRSGetLineItems In sqlRStbl.Rows

Next

Issue I have is that "BATCH NUMBER" is decimal.  So how do I reference it for use in the query? I am getting an error since I am using .Value.

Thanks,
jimbo99999
ASKER CERTIFIED SOLUTION
Avatar of John (Yiannis) Toutountzoglou
John (Yiannis) Toutountzoglou
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jimbo99999

ASKER

This may sound odd but...

I don't even have an understanding how/why I have to do the converting and .Value or .ToString.  

Are there rules anywhere that can guide me?

I spent hours and hours converting this code using .Value.  At the time I thought it was right since I didnt get any syntax errors.  But now everywhere I have it I get an error when I run it.

Thanks,
jimbo99999
Did you see my comment?
After reviewing your response and jtoutou's, I had to use the following combination to get the code to work:

[BATCH NUMBER]='" & CDec(sqlRSGetLineItems("BATCH NUMBER").ToString) & "'
Are you satisfied with the code?
It works.  Why do you ask? Am I missing something other than not understanding like in my post ID: 38835293?
No you do not missing something . Your are Combining Solutions so you have to accept multiple solutions to close the question