Re: Adding a NULL to an array then adding array to a data table

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Put a 0 in instead?

"Fiddelm3742" <Fiddelm3742@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7AC4A4A0-7182-4D32-B2EF-C70E16BA6811@xxxxxxxxxxxxxxxx
I'm having problems adding some data to my data table where one of my rows
contains a column that has a null value. Here is a snippet of my code
while ((strDataFileLine = DataFile.ReadLine()) != null) //Read till EOF
{
strTokens = strDataFileLine.Split(';'); //Parse
string by ;'s and put in strTokens
for(int i = 0; i < strTokens.Length; i++)
{
if (strTokens[i] == "NULL")
strTokens[i] = DBNull.Value.ToString();
}

if (intTotalColumns == strTokens.Length)
tblToLoad.Rows.Add(strTokens);

I'm reading the data from a text file, parsing it out into an array then
going through the array to check and see if the values contain "NULL" (it
was
"" but i changed it to NULL for readability for my sake) When trying to
add
the row I get the error
Unhandled Exception: System.ArgumentException: Input string was not in a
correct format.Couldn't store <DBNULL> in highquotaamount Column.
Expected
type is Decimal. ---> System.FormatException: Input string was not in a
correct format.
I can't just check for NULL then put DBNull.value in my array because the
array wont accept that type being it's not a string. Is there a good way
to
do this that I'm simply over looking?


--
Matt
www.Fiddelke.org


.



Relevant Pages

  • Help in French|Spanish|German translation.
    ... I am also an author of User-defined string functions. ... WORDTRANEX (cSearched, cArExpressionSought | cExpressionSough, ... each string of the array is searched ... If the parameter nArStartOccurrence is -1 or omitted, the replacement starts ...
    (microsoft.public.fox.helpwanted)
  • Re: passing a string to a dll
    ... Joe, I really appreciate you taking the time to demonstrate this. ... sure how I would implement indexing it for random alphanumeric codes. ... I might handle the array. ... I actually have been wondering if I could use a second string ...
    (microsoft.public.vc.mfc)
  • Re: passing a string to a dll
    ... I might handle the array. ... I actually have been wondering if I could use a second string ... look at insertion cost, organization cost, and search cost. ...
    (microsoft.public.vc.mfc)
  • RE: Structure conversion from C++ to VB-2008?
    ... One of the most important structures is AmiVar structure. ... point number, the array of floating point numbers, a string or IDispatch ... Dim 13012679 as Integer ...
    (microsoft.public.dotnet.languages.vb)
  • Structure conversion from C++ to VB-2008?
    ... One of the most important structures is AmiVar structure. ... point number, the array of floating point numbers, a string or IDispatch ... Dim 13012679 as Integer ...
    (microsoft.public.dotnet.languages.vb)