mysql - vb.net combobox shows only 1 record -


when add cmname clname on .valuemember i'm having error, because im planning show 3 records in asingle combobox, i.e. will a. smith

private sub form4_load(byval sender system.object, byval e system.eventargs) handles mybase.load     con.connectionstring = ("server=localhost;user id=root;database=db")     try         con.open()         cmd             .connection = con             .commandtext = "select cfname, cmname, clname candidate;"         end         dim dt new datatable         combobox1             da.selectcommand = cmd             da.fill(dt)             .datasource = dt             .displaymember = "cfname"             .valuemember = "cfname"         end     catch ex exception         msgbox(ex.message)     end try     con.close() end sub 

you can concatenate values columns in sql command, this:

.commandtext = "select concat_ws(' ', cfname, cmname, clname) fullname candidate;" 

then, set displaymember , valuemember properties concatenated column, this:

.displaymember = "fullname" .valuemember = "fullname" 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -