Wasn't sure how to phrase this question.. Let me explain my problem, I am querying a table that has a book value and a cancel value, so I do the following:
select book_value, cancel_value, (book_value - cancel_value) as total_value from mytable
in mysql workbench, this does exactly what I want. Now, when I query from vb.net, I get the following error:
System.InvalidCastException: Conversion from string "total_value: " to type 'Double' is not valid. --->
System.FormatException: Input string was not in a correct format.
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat)
--- End of inner exception stack trace --- at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Operators.AddObject(Object Left, Object Right)
at cust_info_Default2.Page_Load(Object sender, EventArgs e)
in line 32
Okay, so I can't convert a double to a string, that's fine. So how do I write a query that returns the same thing, but instead of making that column a "double," it comes back as a string?
Any other ideas would be greatly appreciated!
EDIT: code where error is raised is
cmd.CommandText = "select book_value, cancel_value, (book_value - cancel_value) as total_value from mytable"
reader = cmd.ExecuteReader()
EDIT 2: didn't take the right part where the exception is raised... Sorry for the confusion!
listy.Items.Add(col_list(u) + ": " + reader(col_list(u)))
col_list contains the column names returned by the reader. u is the variable I use in the for loop I am going through. and listy is a listbox that is created like
Dim listy As New ListBox
inside of the for loop.