Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Taking the first field from a DataSet

Status
Not open for further replies.

Dross

Programmer
Aug 16, 2001
212
0
0
US
I have a dataset taht if the rowcount is greater than 1 I show it in a datagrid, else I want to redirect it to another page and pass the first field of the row in the string. How do I do that?

So far I have
Server.Transfer("ShowTerritoryInfo.aspx & DS.Tables.Rows(0)")

But I get Error executing child request for ShowTerritoryInfo.aspx & DS.Tables.Rows(0).

Does anyone know the proper syntax?
 
Didn't work. I have
Server.Transfer("ShowTerritoryInfo.aspx" & DS.Tables.Rows(0).Item(0)) and I pretty much get the same error. It is close, just something missing.
 
this?
Server.Transfer("ShowTerritoryInfo.aspx?Field=" & DS.Tables.Rows(0).Item(0))

 
I'm trying to load data into Mobile Controls. One of my routines isn't working, so I tried to get the record count to see if anything was coming in. I have code that populates a datagrid in conventional ASP.NET, but when I ported it to populate a Mobile list, I got some strange dataset property problems. The following is my code:

dadDelivery = New OleDbDataAdapter( "Select * From tblDelivery", connIn )
dadDelivery.Fill( dstDelivery, "tblDelivery" )

'To bind to a datagrid, the code that works says:
dgrdDelivery.DataSource = dstDelivery
dgrdDelivery.DataBind()

'To bind to a Mobile list, the code is:
lstDelivery.DataTextField = dstDelivery
lstDelivery.DataBind()

What I get is an error message that says: BC30311: Value of type 'System.Data.DataSet' cannot be converted to 'String'.

1. Does anyone know where to go to find out how to reference components of a DataSet?
2. Does anyone know where to go to find out what these Mobile error messages mean? The VS.NET Help file is not helpful.



 
You can't take a DataRow and expect it to be converted into a string.

Remember that Rows(0) is a DataRow object and not a string. It contains fields. If you want to pass it the way you have it, you need to convert it to, say, a delimited string first.

EXAMPLE in C#:

string record = "";

for( int i = 0; i < DS.Tables[&quot;YourTable&quot;].Columns.Count; i++ )
{
record += DS.Tables[&quot;YourTable&quot;].Rows[0] + &quot;,&quot;;
}

Use it like: ShowTerritoryInfo.aspx & record

On the receiving page, you would than do a &quot;split&quot; on the string to parse out the info.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top