binding mysql database to dropdown list vb.net -


i need binding mysql database dropdown list.

here's how connect database

dim connectionstring string = configurationmanager.connectionstrings("dbstring").connectionstring dim connectme odbcconnection = new odbcconnection(connectionstring) dim odbcdataset dataset = new dataset() dim sqlquery string = "select * treconcalculation fid = " & request.querystring("id") connectme.open() dim odbcdataadapter odbcdataadapter = new odbcdataadapter(sqlquery, connectme) odbcdataadapter.fill(odbcdataset, "treconcalculation") connectme.close()              make1 = odbcdataset.tables("treconcalculation").rows(0).item(1)             model1 = odbcdataset.tables("treconcalculation").rows(0).item(2)             cc1 = odbcdataset.tables("treconcalculation").rows(0).item(3)             below2 = odbcdataset.tables("treconcalculation").rows(0).item(4)             below3 = odbcdataset.tables("treconcalculation").rows(0).item(5)             below4 = odbcdataset.tables("treconcalculation").rows(0).item(6)             below5 = odbcdataset.tables("treconcalculation").rows(0).item(7)             above5 = odbcdataset.tables("treconcalculation").rows(0).item(8) 

how go implementing dropdown list? i've tried

dim constr string = configurationmanager.connectionstrings("dbstring").connectionstring             using con new sqlconnection(constr)                 using cmd new sqlcommand("select fid, fmake, fmodel treconcalculation")                     cmd.commandtype = commandtype.text                     cmd.connection = con                     using sda new sqldataadapter(cmd)                         dim ds new dataset()                         sda.fill(ds)                         vehicle1.datasource = ds.tables(0)                         vehicle1.datatextfield = "fmodel"                         vehicle1.datavaluefield = "fid"                         vehicle1.databind()                     end using                 end using             end using             vehicle1.items.insert(0, new listitem("--select customer--", "0")) 

and error comes saying keyword not supported: 'driver'.

thanks

so problem not dropdown binding: it's connection string, using connect database: request check whether odbc driver 3.51 installed on machine , check connection string having valid parameters. if building connection string in code suggest use following:

dim _dbhost = "localhost"; dim _dbname = "yourdbname"; dim _dbpassword = "dbuser"; dim _dbuser = "*****"; dim constring = "driver={mysql odbc 3.51 driver};" +                 "server=" + dbhost + ";" +                 "database=" + dbname + ";" +                 "user=" + dbuser + ";" +                 "password=" + dbpassword + ";" +                 "option=3;" 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -