Back to Data Basics

dpatfield66

Well-known member
Joined
Apr 6, 2006
Messages
136
Programming Experience
5-10
I know I can probably find some answers by searching, but I want to get the core basics first.

I've created some SQL Tables, and then I used the VS 2005 wizard to connect them to my forms (.NET)

I am NOT binding any of my controls to the datatable that results, but rather, I've used a datagrid for users to select a record, and then when they do, I use a customized tableAdapter.fill() method that queries on the Primary ID of the selected record. I then (via code), set all my controls to each field that's in the datatable (derived from the dataset).

I'm not sure If I'm doing this the right way, because I'm doing alot of formatting (for dates and such) prior to filling my controls.

And WORSE, when I want to go the other way (fill the SQL table using a customized tableAdapter.Insert() method, I have to format the daylight out of some fields (example...if I have a masked date field that's empty, for some reason it's read as " / / ", because I've formatted the string as 00/00/00 prior. And now the SQL table won't take it.

There's a few questions above, so let me try to sum it up:

Is there a standard way to bind data to the datatable, and then get it over to the SQL table when a button is pressed?

And how do I deal with these darned dates? I need them masked, but the mask field takes strings and not dates. I can do calculations on these string values, but I can't get them back to the SQL table when updated, or edited.

And if I DON'T want to use a numericupdown, how can I get a control to accept a number and keep it a number when going back to the SQL table?
 
Back
Top