select from database

Discussion in 'ASP .Net' started by mike7510uk, Dec 14, 2006.

  1. mike7510uk

    mike7510uk Guest

    hi,
    i have a gridview with a templatefield that contains a checkbox. this
    all works fine and update database fine. But the problem i have is that
    if the user checks a box, closes the application, then re-opens
    application, the box is no longer checked.
    How can i check DB for the checked value (in this case a 1 for checked
    or 0 for unchecked)?
    mike7510uk, Dec 14, 2006
    #1
    1. Advertising

  2. mike7510uk

    Daniel Guest

    You could do that in 2 ways.

    1) a database as you said
    2) a settings file. And after they make their changes they click a save
    button and it writes to the settings file, load it at start up

    But the database way is very easy also. Look up sql adapters and simple
    database connection. Then do a sql statement to select the data you saved to
    the db, for example "select chkstate from settingsTbl where userid=10;"

    "mike7510uk" <> wrote in message
    news:...
    > hi,
    > i have a gridview with a templatefield that contains a checkbox. this
    > all works fine and update database fine. But the problem i have is that
    > if the user checks a box, closes the application, then re-opens
    > application, the box is no longer checked.
    > How can i check DB for the checked value (in this case a 1 for checked
    > or 0 for unchecked)?
    >
    Daniel, Dec 14, 2006
    #2
    1. Advertising

  3. mike7510uk

    David Wier Guest

    Have a field in the database be a bit field. - then, when saving, just
    'feed' it the checkbox.checked property.
    Then, when retrieving the data, assign the output of the database to the
    checkbox

    --
    David Wier
    MVP/ASPInsider
    http://aspnet101.com
    http://aspexpress.com


    "mike7510uk" <> wrote in message
    news:...
    > hi,
    > i have a gridview with a templatefield that contains a checkbox. this
    > all works fine and update database fine. But the problem i have is that
    > if the user checks a box, closes the application, then re-opens
    > application, the box is no longer checked.
    > How can i check DB for the checked value (in this case a 1 for checked
    > or 0 for unchecked)?
    >
    David Wier, Dec 14, 2006
    #3
  4. mike7510uk

    mike7510uk Guest

    Thanks guys
    i have done this by using the Checked='<%# Bind("save") %>' property

    David Wier wrote:
    > Have a field in the database be a bit field. - then, when saving, just
    > 'feed' it the checkbox.checked property.
    > Then, when retrieving the data, assign the output of the database to the
    > checkbox
    >
    > --
    > David Wier
    > MVP/ASPInsider
    > http://aspnet101.com
    > http://aspexpress.com
    >
    >
    > "mike7510uk" <> wrote in message
    > news:...
    > > hi,
    > > i have a gridview with a templatefield that contains a checkbox. this
    > > all works fine and update database fine. But the problem i have is that
    > > if the user checks a box, closes the application, then re-opens
    > > application, the box is no longer checked.
    > > How can i check DB for the checked value (in this case a 1 for checked
    > > or 0 for unchecked)?
    > >
    mike7510uk, Dec 14, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGFiYmxlcg==?=

    select gridview row without using select button?

    =?Utf-8?B?RGFiYmxlcg==?=, Mar 3, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    101,499
    dch31969
    Feb 27, 2009
  2. J. Hall
    Replies:
    2
    Views:
    1,044
    Jeff Thies
    Apr 21, 2004
  3. jas

    select.select() on windows

    jas, Oct 25, 2005, in forum: Python
    Replies:
    4
    Views:
    777
    Maksim Kasimov
    Oct 27, 2005
  4. Laszlo Nagy

    select.select and socket.setblocking

    Laszlo Nagy, Dec 30, 2008, in forum: Python
    Replies:
    12
    Views:
    1,162
    Roy Smith
    Jan 3, 2009
  5. palmiere
    Replies:
    1
    Views:
    388
    Erwin Moller
    Feb 9, 2004
Loading...

Share This Page