select from database

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)?
 
D

Daniel

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;"
 
D

David Wier

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
 
M

mike7510uk

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

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

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top