Simple access to a column of a dataset??

Results 1 to 2 of 2

Thread: Simple access to a column of a dataset??

  1. #1
    Join Date
    Dec 1969

    Default Simple access to a column of a dataset??

    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!

  2. #2
    Join Date
    Dec 1969

    Default RE: Simple access to a column of a dataset??

    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>&#060;%@ Import Namespace="System.Data" %&#062;<BR>&#060;%@ Import Namespace="System.Data.SQL" %&#062;<BR><BR>&#060;script language="VB" runat="server"&#062;<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=;databa se=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>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts