select from database

  • Thread starter Thread starter mike7510uk
  • Start date Start date
M

mike7510uk

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)?
 
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;"
 
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
 

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

Back
Top