Simple access to a column of a dataset??

sdtowbabe

New Member
Dawn! I have been looking all over the net to find an exemple of Database work in ASP+ that don&#039t only use a datagrid!<BR><BR>I just don&#039t know how to access direcly a colum of my dataset so I can put it in a variable<BR>like we were doing with the recordset of the ADO :<BR>myvar = myrecordset("columname")<BR><BR>any help will be appreciated!Below is a code(HTML removed) snippet from the ASP+ "How do I..." material that demonstrates how to access the CustomerID field in the Customer table of the Northwind database. This code prints out the string to a web page but it could be easily modified to assign the string to a variable or array. Hope this helps.<BR><BR><BR><%@ Import Namespace="System.Data" %><BR><%@ Import Namespace="System.Data.SQL" %><BR><BR><script language="VB" runat="server"><BR><BR>Dim dsCustomer as DataSet <BR>Dim CustomersDSCommand as SQLDataSetCommand<BR><BR> Protected Sub Page_Load(Src as object, E as EventArgs ) <BR> Dim myConnection as SQLConnection<BR> myConnection = new SQLConnection("server=localhost;uid=sa;pwd=;database=northwind")<BR><BR> CustomersDSCommand = new SQLDataSetCommand("select * from customers", myConnection)<BR><BR> dsCustomer = new DataSet()<BR> CustomersDSCommand.FillDataSet(dsCustomer, "Customers")<BR><BR> Dim Customer as DataRow<BR> For Each Customer in dsCustomer.Tables("Customers").Rows<BR> Response.Write(Customer("CustomerId").ToString())<BR> Next<BR> End Sub<BR>
 
Back
Top