Welcome Guest Search | Active Topics | Members | Log In | Register

Single Cell Data Options · View
Alexey Smirnov
Posted: Thursday, October 04, 2007 6:27:11 PM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 04/10/2007 18:27:11
Date: Thu, 04 Oct 2007 18:27:11 -0000

On Oct 4, 5:53 pm, "Paul W Smith" <p...@NOSPAM.twelve.me.uk> wrote:
> Please excuse the my frustration if it comes through while writing this
> request for help.
> I have created a DataGird and populated it with data from an
> AccessDataSource. This was easy, I followed the steps from the various web
> tutorials on ASP.NET within 15 minutes I have on a web page a display of the
> content of my DB table, which I could alter by changing the SQL statement.
>
> Now the next thing I wanted to do was display the contents of another DB
> query, one that would return just one piece of information, and display that
> on my web page as a page heading. Surely, I thought I do not have to
> display this as another datagrid, it would be just one cell by one cell?
>
> Well try as I might I cannot seen to find a simple way to display this
> single piece of information, as neither the label, textbox or literal has
> any way to bind data to it (well that I can find).
>
> Can anyone please give me simple instructions on how to output the content
> of a AccessDataSource to a single cell entitiy. Or confirm that everyone
> else in the world uses a datagrid for this!
>
> PWS

If you have a source like this

<asp:AccessDataSource id="AccessDataSource1" runat="server"
DataFile="....mdb" SelectCommand="Select Top 1 bla-bla...." />

you can get the value out of it referring to id of AccessDataSource
and a Select method.

For example, here I would get a first column of first row

<
%=((System.Data.DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty)).Table.Rows[0]
[0] %>

To make it more clear you can do the same having a piece of code as
here

<script runat="server">
private void Page_Load(Object sender, System.EventArgs e)
{
System.Data.DataView dv =
AccessDataSource1.Select(DataSourceSelectArguments.Empty);
string s = (string) dv.Table.Rows[0][0];
Label1.Text = s;
</script>

<asp:Label id="Label1" .....

Hope it works :-)

Paul W Smith
Posted: Thursday, October 04, 2007 7:53:52 PM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 04/10/2007 19:53:52
Date: Thu, 4 Oct 2007 17:53:52 +0200

Please excuse the my frustration if it comes through while writing this
request for help.
I have created a DataGird and populated it with data from an
AccessDataSource. This was easy, I followed the steps from the various web
tutorials on ASP.NET within 15 minutes I have on a web page a display of the
content of my DB table, which I could alter by changing the SQL statement.

Now the next thing I wanted to do was display the contents of another DB
query, one that would return just one piece of information, and display that
on my web page as a page heading. Surely, I thought I do not have to
display this as another datagrid, it would be just one cell by one cell?

Well try as I might I cannot seen to find a simple way to display this
single piece of information, as neither the label, textbox or literal has
any way to bind data to it (well that I can find).

Can anyone please give me simple instructions on how to output the content
of a AccessDataSource to a single cell entitiy. Or confirm that everyone
else in the world uses a datagrid for this!



PWS


Paul W Smith
Posted: Friday, October 05, 2007 9:52:41 PM


Rank: Guest
Groups: Guest

Joined: 9/17/2007
Posts: 11,670
Points: -1,200
Date parsed: 05/10/2007 21:52:41
Date: Fri, 5 Oct 2007 19:52:41 +0200


Alexey,

Any chance of your advice in VB?

I am not sure how to implement your suggestion given it in in CS. I have
tried all alternatives but cannot get it to owrk :-(


> %=((System.Data.DataView)AccessDataSource1.Select(DataSourceSelectArguments.Empty)).Table.Rows[0]
> [0] %>
>
> To make it more clear you can do the same having a piece of code as
> here
>
> <script runat="server">
> private void Page_Load(Object sender, System.EventArgs e)
> {
> System.Data.DataView dv =
> AccessDataSource1.Select(DataSourceSelectArguments.Empty);
> string s = (string) dv.Table.Rows[0][0];
> Label1.Text = s;
> </script>
>
> <asp:Label id="Label1" .....
>
> Hope it works :-)
>


Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.1 (NET v2.0) - 9/10/2007
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.
This page was generated in 0.296 seconds.