asp.net - in vb.net, why do I get an error when reading mysql query results? -


wasn't sure how phrase question.. let me explain problem, querying table has book value , cancel value, following:

select book_value, cancel_value, (book_value - cancel_value) total_value mytable 

in mysql workbench, want. now, when query vb.net, following error:

system.invalidcastexception: conversion string "total_value: " type 'double' not valid. --->  system.formatexception: input string not in correct format.    @ microsoft.visualbasic.compilerservices.conversions.parsedouble(string value, numberformatinfo numberformat)    @ microsoft.visualbasic.compilerservices.conversions.todouble(string value, numberformatinfo numberformat)    --- end of inner exception stack trace ---   @  microsoft.visualbasic.compilerservices.conversions.todouble(string value, numberformatinfo numberformat)   @ microsoft.visualbasic.compilerservices.operators.addobject(object left, object right)    @ cust_info_default2.page_load(object sender, eventargs e)  in line 32 

okay, can't convert double string, that's fine. how write query returns same thing, instead of making column "double," comes string?

any other ideas appreciated!

edit: code error raised is

        cmd.commandtext = "select book_value, cancel_value, (book_value - cancel_value) total_value mytable"         reader = cmd.executereader() 

edit 2: didn't take right part exception raised... sorry confusion!

listy.items.add(col_list(u) + ": " + reader(col_list(u))) 

col_list contains column names returned reader. u variable use in loop going through. , listy listbox created like

dim listy new listbox 

inside of loop.

change line

listy.items.add(col_list(u) + ": " + reader(col_list(u))) 

to

listy.items.add(col_list(u) & ": " & reader(col_list(u))) 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -