c# - Adding the results of multiple queries to a collection and displaying collection in a div -


i want able run queries below , return results line line in div. results added hashtable passing method , display in div.

the first query in array arrayofqueries[0] can return multiple lines que:

  1. how can write handle multiple lines returned query in array --- arrayofqueries[0]. i.e want able store multiple lines in harsh table or maybe should using stringbuilder object.

  2. how can display content of hashtable in div.

    public hashtable displayresultstousers(int genjobid) {     hashtable myht = new hashtable();     try     {         string[] arrayofqueries = new string[4];         arrayofqueries[0] = "select generic, customernumber, productcode u_generic_data row_status = 2 , generic_job_id =" + genjobid;         arrayofqueries[1] = "select count(*) u_generic_data row_status = 2 , generic_job_id =" + genjobid;         arrayofqueries[2] = "select count(*) u_generic_data row_status = 1 , generic_job_id =" + genjobid;         arrayofqueries[3] = "select count(*) u_generic_data row_status = 0 , generic_job_id =" + genjobid;          string connect = configurationmanager.connectionstrings["myconnect"].connectionstring;          using (odbcconnection resconnect = new odbcconnection(connect))         {             string sqlstmt = string.empty;             string queryresult = string.empty;             int count = 0;             odbccommand dbcmd = new odbccommand();             dbcmd.connection = resconnect;             resconnect.open();              foreach (string s in arrayofqueries)             {                 dbcmd.commandtext = s;                 queryresult =  convert.tostring(dbcmd.executescalar());                 count = count + 1;                 myht.add(count, queryresult);             }              resconnect.close();         }      }     catch (exception ex)     {       }      return myht; 

dbcmd.executescalar() not work query such select generic, customernumber, productcode u_generic_data row_status = 2 , generic_job_id =" + genjobid. need dbcmd.executereader() or other overload retrieve columns. executescalar() fine select count(*) queries.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -