Jimbo99999
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did you see my comment?
ASKER
After reviewing your response and jtoutou's, I had to use the following combination to get the code to work:
[BATCH NUMBER]='" & CDec(sqlRSGetLineItems("BA TCH NUMBER").ToString) & "'
[BATCH NUMBER]='" & CDec(sqlRSGetLineItems("BA
Are you satisfied with the code?
ASKER
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
ASKER
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