andycharger Posted August 1, 2003 Posted August 1, 2003 Im trying to put a table on my form to display a list of results from a plans table on my database. However, I need to know how I get it to the screen. Do I put the code for accessing the data in the code section or in the HTML section? Also how is best to put it into a table? Here is my code so far: Dim oConn As SqlConnection Dim oComm As SqlCommand Dim oReader As SqlDataReader Dim sSQL As String Dim sConn As String Dim strDept As String strDept = Request.QueryString("dept_id") sSQL = "SELECT * " sSQL += "FROM Plans where department_id = " & strDept sConn = ConfigurationSettings.AppSettings("ConnectionString") oConn = New SqlConnection(sConn) oConn.Open() oComm = New SqlCommand(sSQL, oConn) oReader = oComm.ExecuteReader() **********writing the results to a table I expect should go here ********* oConn.Close() Thanks! Quote
JABE Posted August 1, 2003 Posted August 1, 2003 Read up the HTMLTable class; it should serve you well for your problem. Quote
mr relaxo Posted August 2, 2003 Posted August 2, 2003 or you can use the asp.net datagrid which has the format of a table. very simple. in the body of your html you stick: <asp:datagrid id="dgresults" runat="server" /> then instead of this: oReader = oComm.ExecuteReader() put: dgresults.datsource = oComm.executereader() dgresults.databind () you dont even need the datareader object in this case. Quote You can not get ye flask.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.