By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,459 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

SQL Data Source, refresh and access data rows in web forms Codebeh

P: n/a
I'm new to both VS2005 and C# Web Forms (Though I have tons of experience
with VB.Net and VS2003).

Creating a Data Source visually in VS2005 is easy as pie - I love it, but
how do you or would you ever use this control to create a dataview or dataset
or datatable that you could programmatically navigate and read field contents
in a C# codebehind?

I actually want to set the value of a 'label' to be the first value of the
first field of a SQL query but I can't seem to have at the underlying
datatable of the Data Source. I see tons of examples not using a GUI tool but
using a data reader, etc. But these are all constructed in code from the
ground up.

Is that the way everybody does it? create a datareader, set its connection,
supply it a query string then execute it, then loop through it then set the
'text' property of my control? I'll do it that way but... I thought a goal of
VS2005 Web forms was to eliminate as much of the code behind as possible.
How much of this picture am i missing?
--
Frank Kirchner
Programmer Analyst
Regional Development
SYSCO Corp.

Sep 27 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You can try dragging the dataset or individual columns from the datasource
window to your form window.

I can do this to a Windows Form. I am not sure about the Web Form. I don't
do Web Stuff.

Hope it works.

WJ

"frankkirchner" <fr***********@discussions.microsoft.comwrote in message
news:3D**********************************@microsof t.com...
I'm new to both VS2005 and C# Web Forms (Though I have tons of experience
with VB.Net and VS2003).

Creating a Data Source visually in VS2005 is easy as pie - I love it, but
how do you or would you ever use this control to create a dataview or
dataset
or datatable that you could programmatically navigate and read field
contents
in a C# codebehind?

I actually want to set the value of a 'label' to be the first value of the
first field of a SQL query but I can't seem to have at the underlying
datatable of the Data Source. I see tons of examples not using a GUI tool
but
using a data reader, etc. But these are all constructed in code from the
ground up.

Is that the way everybody does it? create a datareader, set its
connection,
supply it a query string then execute it, then loop through it then set
the
'text' property of my control? I'll do it that way but... I thought a goal
of
VS2005 Web forms was to eliminate as much of the code behind as possible.
How much of this picture am i missing?
--
Frank Kirchner
Programmer Analyst
Regional Development
SYSCO Corp.

Sep 27 '06 #2

P: n/a
No it does not work that way with Web Forms in VS2005
--
Frank Kirchner
Programmer Analyst
Regional Development
SYSCO Corp.
"Wanjun Yu" wrote:
You can try dragging the dataset or individual columns from the datasource
window to your form window.

I can do this to a Windows Form. I am not sure about the Web Form. I don't
do Web Stuff.

Hope it works.

WJ

"frankkirchner" <fr***********@discussions.microsoft.comwrote in message
news:3D**********************************@microsof t.com...
I'm new to both VS2005 and C# Web Forms (Though I have tons of experience
with VB.Net and VS2003).

Creating a Data Source visually in VS2005 is easy as pie - I love it, but
how do you or would you ever use this control to create a dataview or
dataset
or datatable that you could programmatically navigate and read field
contents
in a C# codebehind?

I actually want to set the value of a 'label' to be the first value of the
first field of a SQL query but I can't seem to have at the underlying
datatable of the Data Source. I see tons of examples not using a GUI tool
but
using a data reader, etc. But these are all constructed in code from the
ground up.

Is that the way everybody does it? create a datareader, set its
connection,
supply it a query string then execute it, then loop through it then set
the
'text' property of my control? I'll do it that way but... I thought a goal
of
VS2005 Web forms was to eliminate as much of the code behind as possible.
How much of this picture am i missing?
--
Frank Kirchner
Programmer Analyst
Regional Development
SYSCO Corp.


Sep 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.