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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • frankkirchner

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

    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 programmaticall y 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.

  • Wanjun Yu

    #2
    Re: SQL Data Source, refresh and access data rows in web forms Codebeh

    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

    "frankkirch ner" <frankkirchner@ discussions.mic rosoft.comwrote in message
    news:3DC46C0F-48E2-4A3A-8DE2-1728D6D89A8F@mi crosoft.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 programmaticall y 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.
    >

    Comment

    • frankkirchner

      #3
      Re: SQL Data Source, refresh and access data rows in web forms Cod

      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
      >
      "frankkirch ner" <frankkirchner@ discussions.mic rosoft.comwrote in message
      news:3DC46C0F-48E2-4A3A-8DE2-1728D6D89A8F@mi crosoft.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 programmaticall y 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.
      >
      >
      >

      Comment

      Working...