Convert Negative String to Negative Decimal

I am working on a commission statement system. When uploading an import txt file with commission records, I need to strip each row and insert the row’s data to an sql table. So below the code separates each row item, and then sends the items value to the table. I am having trouble however if the commission is a negative string. for ex. -1.40. Any ideas on how to convert a negative string to a decimal?

thanks in advance!

string[] items = allLines[index].Split(new char[] { ‘t’ });

cmd.Parameters[“@commission_amount”].Value = Convert.ToDecimal(items[2]);

submitted by /u/alexd612
[link] [comments]

Leave a Reply