mysql - conversion from string to double is not valid -


imports mysql.data.mysqlclient

public class bookingform

dim mysqlconn mysqlconnection dim command mysqlcommand dim valid boolean = false     private sub button1_click(sender object, e eventargs) handles button1.click     call input_validation()      mysqlconn = new mysqlconnection     mysqlconn.connectionstring = "server = localhost; database = venuesdb; user id = root; password = "     dim reader mysqldatareader      try         mysqlconn.open()         dim query string         query = "insert venuesdb.event(venueid, eventname, eventdate, eventstarttime, eventendtime, eventid, customerid) values ('" & textbox1.text & "', '" & textbox2.text & "', '" & datetimepicker1.text & "', '" & textbox4.text & "', '" & textbox5.text & "', '" & textbox6.text & "', '" & textbox7.text & "')"         command = new mysqlcommand(query, mysqlconn)         reader = command.executereader          messagebox.show("booking added")         mysqlconn.close()         if textbox1.text = 0             messagebox.show("please enter text")         end if     catch ex exception         messagebox.show(ex.message)             mysqlconn.dispose()          textbox1.clear()         textbox2.clear()          textbox4.clear()         textbox5.clear()         textbox6.clear()         textbox7.clear()     end try  end sub  private sub button2_click(sender object, e eventargs) handles button2.click     mysqlconn = new mysqlconnection     mysqlconn.connectionstring = "server = localhost; database = venuesdb; user id = root; password = "     dim reader mysqldatareader      try         mysqlconn.open()         dim query string         query = "delete venuesdb.event eventname = '" & combobox1.text & "'"         command = new mysqlcommand(query, mysqlconn)         reader = command.executereader          messagebox.show("booking deleted")         mysqlconn.close()      catch ex exception         messagebox.show(ex.message)             mysqlconn.dispose()      end try end sub  private sub tabpage2_load(sender object, e eventargs) handles mybase.load     mysqlconn = new mysqlconnection     mysqlconn.connectionstring = "server = localhost; database = venuesdb; user id = root; password = "     dim reader mysqldatareader      try         mysqlconn.open()         dim query string         query = "select * venuesdb.event"         command = new mysqlcommand(query, mysqlconn)         reader = command.executereader         while reader.read             dim bandname = reader.getstring("eventname")             combobox1.items.add(bandname)         end while          mysqlconn.close()      catch ex exception         messagebox.show(ex.message)             mysqlconn.dispose()     end try  end sub  private sub bookingform_load(sender object, e eventargs) handles mybase.load  end sub  private sub tabpage3_load(sender object, e eventargs) handles mybase.load     mysqlconn = new mysqlconnection     mysqlconn.connectionstring = "server = localhost; database = venuesdb; user id = root; password = "     dim reader mysqldatareader      try         mysqlconn.open()         dim query string         query = "select * venuesdb.event"         command = new mysqlcommand(query, mysqlconn)         reader = command.executereader         while reader.read             dim bandname = reader.getstring("eventname")             combobox2.items.add(bandname)         end while          mysqlconn.close()      catch ex exception         messagebox.show(ex.message)             mysqlconn.dispose()      end try end sub  private sub combobox2_selectedindexchanged(sender object, e eventargs) handles combobox2.selectedindexchanged     mysqlconn = new mysqlconnection     mysqlconn.connectionstring = "server = localhost; database = venuesdb; user id = root; password = "     dim reader mysqldatareader      try         mysqlconn.open()         dim query string         query = "select * venuesdb.event eventname = '" & combobox2.text & "'"         command = new mysqlcommand(query, mysqlconn)         reader = command.executereader         while reader.read             textbox14.text = reader.getstring("eventname")             textbox13.text = reader.getstring("venueid")              textbox11.text = reader.getstring("eventstarttime")             textbox10.text = reader.getstring("eventendtime")             textbox9.text = reader.getstring("eventid")             textbox8.text = reader.getstring("customerid")             datetimepicker2.text = reader.getdatetime("eventdate")          end while          mysqlconn.close()      catch ex exception         messagebox.show(ex.message)             mysqlconn.dispose()      end try end sub  private sub button3_click(sender object, e eventargs) handles button3.click     mysqlconn = new mysqlconnection     mysqlconn.connectionstring = "server = localhost; database = venuesdb; user id = root; password = "     dim reader mysqldatareader      try         mysqlconn.open()         dim query string         query = "update venuesdb.event set eventname = '" & textbox1.text & "', venueid = '" & textbox2.text & "', eventdate = '" & datetimepicker2.text & "'where eventname = '" & textbox1.text & "'"         command = new mysqlcommand(query, mysqlconn)         reader = command.executereader          messagebox.show("booking updated")         mysqlconn.close()      catch ex exception         messagebox.show(ex.message)             mysqlconn.dispose()      end try      textbox1.clear()     textbox2.clear()      textbox4.clear()     textbox5.clear()     textbox6.clear()     textbox7.clear() end sub 

i have error keeps popping when click button error says "conversion string "" type double not valid" can see have not tried convert double

please help

this implicitly attempt convert double attempt run comparison:

if textbox1.text = 0     messagebox.show("please enter text") end if 

you may want wrap (and other occurrence) in

if textbox1.text <> ""     if textbox1.text = 0         messagebox.show("please enter text")     end if end if 

or, perhaps better, change to:

if textbox1.text.length = 0      .... 

or

if textbox1.text = ""     .... 

comparing length not attempt convert double before comparison.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -