sql - select statement times out -
i need populate dropdown menues table contains 4 million rows.
how can without having time out on select statement?
is need sql injections. ? or else ?
now tried top 100 rows . project have lot of users , lot of details in database . need show values in dropdownlist , current code here :
protected void searchbutton_click(object sender, eventargs e) { var search = yourseachtextbox.text.trim(); if(!string.isnullorempty(search) && search.length > 3) { using(sqlconnection sqlconnection = new sqlconnection("your connection string")) { var query = "select top 100 * [yourtable] username @search"; sqlcommand sqlcommand = new sqlcommand(query,sqlconnection); sqlcommand.parameters.addwithvalue("@search", search + "%"); } } }
i assume intend populate drop downs parts aof 4 million rows? have create indexes on columns separate them!
if intend populate them of contents @ once, things have timeout sure clients browsers won't handle this!
Comments
Post a Comment