Friday, 15 May 2015

sql - Proper populating of dropdown list in asp.net dynamically -



sql - Proper populating of dropdown list in asp.net dynamically -

i newbie in asp.net, want inquire more proper in terms of populating dropdown list in asp.net? using datasource or using sqldatareader , loop.

i using sqldatareader , loop, here sample code:

for = 1 20 etc.commandtext = "select classification schemaitemdetails.assetclassification ac_id = " & & "" dim dr sqldatareader = etc.executereader while (dr.read()) ddoneclassification.items.add(dr.getstring(0)) end while dr.close() next

is there difference in using sqldatasource , one?? never utilize sqldatasource populating dropdown.

from point of view easiest , best solution set dropdownlist's datasource property. in case, required job done behind scene , neednd't think of synchronization info between db server , web server.

also, if you, modify sql single request sent db server, i.e.

"select classification schemaitemdetails.assetclassification ac_id between 1 , 20"

asp.net sql sqldatasource sqldatareader

No comments:

Post a Comment