jblackheadwhjx
New Member
hi,<BR> I can't find anything anywhere about how to access specific fields in a dataset... or how to iterate through that dataset...<BR><BR>I've found numerous articles on databinding it to a datagrid... but I don't want to databind it... I want it to have the same functionality as an oldschool recordset where I can sprinkle values from the dataset around the ASP page....<BR><BR>thanks in advanceGot It!<BR><BR>far as I can tell, there's no .movenext type of method for the dataset. but you can loop through it and use the values as you wish using a "For Each" loop... like this:<BR>-----------------<BR>Dim Conn as ADOConnection<BR>conn = New ADOConnection("dsn=LocalServer;pwd=;uid=")<BR>conn.open<BR><BR>dim SQL as String = "SELECT * From Table"<BR><BR>dim DSCmd as ADODataSetCommand<BR>dim DS as ADODataSet<BR><BR>DSCmd = New ADODataSetCommand(SQL, Conn)<BR>Conn.close<BR>Conn = nothing<BR><BR>DS = new DataSet<BR>DSCmd.FillDataSet(DS, "DSName")<BR><BR>'** Loop Through the DataSet<BR><BR>for each item in ds.tables("dsName").rows<BR> response.write(item("ColumnName").tostring() & "---> ")<BR>next<BR>------------------<BR><BR>the point of that is that you canuse any of the column of the dataset in any order you wish...<BR><BR>Hope it Helps someone else<BR>Joel Martinez