Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I did not understand your question well, but as far as i understood. I think you require the multiple values from the reader on your asp page. If this is the requirement then what you can do is, just create one class which will contain all the column name which will be there in the reader.</p> <p>The method which is there in your DataClassLibrary will return the List.</p> <p>The below example will help you:</p> <pre><code>public class User { public long nUser { get; set; } public string cUserID { get; set; } public string cName { get; set; } public string cPassword { get; set; } } public class cUser { public List&lt;User&gt; GetUsers() { try { SqlConnection connection = new SqlConnection(ConnectionString); command = new SqlCommand(connection); command.CommandType = CommandType.Text; List&lt;User&gt; tuserList = new List&lt;User&gt;(); User tuser = null; connection.Open(); reader = command.ExecuteReader(); while (reader.Read()) { tuser = new User(); tuser.nUser = long.Parse(reader["nUser"].ToString()); tuser.cUserID = reader["cUserID"].ToString(); tuser.cName = reader["cName"].ToString(); tuser.cPassword = reader["cPassword"].ToString(); tuserList.Add(tuser); } return tuserList; } catch (SqlException ex) { return null; } catch (Exception ex) { return null; } finally { if (reader != null) { reader.Close(); } if (connection != null) { connection.Close(); } } } } </code></pre> <p>On ASPX page:</p> <p>just create the object of the class in which this method is there. and get it. Suppose it is there in the cUser class.</p> <pre><code> cUser a = new cUser(); var list = a.GetUsers(); </code></pre> <p>I hope it will help you.. :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload