If you don't use a SQLDataAdapter as your binding source, what do you recommend? There appear to be a few different ways to bind the the DataGridView to the database -- I think I just used a method I found in Microsoft's docs. (While I'm a resonably experienced programmer, I'm pretty new to .NET.)
Art Frank
Posts
-
.NET DataGridView question -
.NET DataGridView questionThanks for the advice. I think I'll do what you suggest -- force the user to double-click the row to edit, then present a form showing just that record. Since the editing is minimal, I was hoping to get away with just a table, but this is probably better design.
-
.NET DataGridView questionA contrived example that demonstrates what I'm trying to accomplish: Four tables, like so: main_table: persons_name car color car_lookup: car_id car_description color_lookup: color_id color_description car_color: car_id color_id The idea is that for each type of car in the car_lookup table, there are only a few values in the color_lookup table that are valid. The car_color table has the all of the color_id values that are valid for each car_id (that is, if I select all of the rows for a particluar car_id, I'll retrieve all of the valid color_ids for that car). Question 1: ok design? Is there a better way to approach this? Question 2: I'm using a DataGridView to present the main_table to the end-user for editing. Works fine when I'm just presenting the table with the car and color fields just showing ID numbers. How can I present the data so that the DataGridView presents the car_description instead of the car_id that is in the car field (and this one field is not changeable) and for the color field present a drop down of just the valid colors for the given car_id? This would mean that the drop down is different for each row. If car #1 could be only green or blue, whereas car #2 could be blue or red, then the drop down would reflect that. The database is on a SQL server, the DataGridView is connected to a BindingSource, which is connected to a SqlDataAdapter. Unsure if this belongs in the .NET section or here. Apologies if this is the wrong place. I'm writing in C#, but any general DataGridView info would be appreciated.