Posted on 2006-06-19
I have never actually worked with Datasets ...
I always use the sqlConnection , sqlCommand, and the sqlDataReader ,
I have a project where i have to read most of the columns i have in a database into a datagrid.
Make all the columns red except for 2 columns which must be green.
The Red Columns must be read only and the green the user can change.
1 of the green columns is a (currency) field .. so the user must only be able to put in Money values 32.12 for example.
and the other column is a Bit field ... which shows a Checkbox.
As i said , i've never worked with datasets, so i actually got it to show the columns from the database by actually adding row by row .. (reading from a datareader).
I got it to colour the rows and only make those 2 NOT read only.
The problems i am having now is
1). When i put in a non Money value ... Like 231afd.12.. and i leave the cell - it complains ... and i have tried putting error handling everywhere which i think is necessary ..
2). Saving - I must loop through the entire grid and apply the changes ... where i hear in a dataset you can just call an update command that will do everything ? (i don't know how to loop through the datagrid to make it save....)
Please help me fix these 2 problems or maybe you can help me to make it load the grid from the database using a dataset (a quick crash course) :) . So the saving can be easy.