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

G

Guest

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?
 
W

Wanjun Yu

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top