|
Greetings everyone. My development platform is Visual Studio C# 2008 Express and SQL Compact on XP-Pro. I am crafting a C# application that has one DataSet with six TableAdapters and BindingSources. The application and the IDE is working as expected at this point. I decide that I need to add a new feature which requires me to add a new database table, TableAdapter, and BindingSource to the project solution. First, I add the new database table using the Database Explorer with no unexpected issues. Second, I created the new TableAdapter using the GUI Designer tool I get when I right-mouse click the DataSet.xsd component in the Solution Explorer and and clicking "View Designer". Again, no unexpected issues with the TableAdapter creation. Third, I open my form with the form designer, show the Toolbox, and drop the new TableAdapter onto the form from the project components area. Again no unexpected issues except I notice I did not get a TableAdapter.Fill statement automatically added to my Form.cs module. Strange, but I can add that manually. Lastly, I drop a new BindingSource onto the form and use the Properties window to set the DataSource and DataMember properties. This is where it gets stubborn. I set the DataSource to the appropriate DataSet without issue, but when setting the DataMember property, the IDE does not show the new Table as a choice. When I manually type the new table name, it complains that it doesn't exist. I find all of the expected references to the new table in the DataSet.Designer.cs module. I also find the expected references to the new TableAdapter and BindingSource in the Form.Designer.cs module. I suspect something is not getting updated in the IDE. When I manually add the BindingSource property settings to the Form.Designer.cs module and try to open the gui form designer, it complains that the DataMember property does not exist in the DataSource. What am I missing or overlooking? I would appreciate suggestions or pointers to where to look. Thanks in advance. - Changed TypeKira QianMSFT, ModeratorWednesday, July 22, 2009 6:38 AM
- Changed TypeKira QianMSFT, ModeratorWednesday, July 29, 2009 2:14 AM
-
| | Old Mr.Ed Wednesday, July 15, 2009 9:40 PM | Hi Kira Sorry for the delay. Murphy's Law seems to interject itself at the most inopportune times and I had divert my attention for a few days. This question can be closed. As I had mentioned in my last reply, the IDE misbehavior seems to be related to my changing where the DB ConnectionString was being stored. It would appear that the IDE wanted the ConnectionString in the standard location(s) in order to update itself with changes in the database. When I returned the ConnectionString to its standard place, the IDE worked as it should. I can live with that during development. When development is complete, I can move the ConnectionString back to where I want it. Thanks again and please accept my apologies for the excessive delay.
- Marked As Answer byKira QianMSFT, ModeratorWednesday, July 29, 2009 2:14 AM
-
| | Old Mr.Ed Tuesday, July 28, 2009 4:18 PM | If I understand your issue correctly, the DataMember property is expecting a string. So if you table name was customer, it would be this: myBindingSource.DataMember = "customer". Alternatively, you could do this: myBindingSource.DataSource = myDataSet.Tables(0) Hope this helps. www.insteptech.com ;
msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS! | | DeborahK Wednesday, July 15, 2009 10:32 PM | Thank you, DeborahK, for the reply. Indeed, I can set the DataSource property as you suggest and avoid complaints from the form designer. However, if I specify the DataMember property in the code, the form designer complains loudly on startup that the "DataMember property 'MyNewTable' cannot be found in the DataSource". I shouldn't have to resort to that tactic since the other six TableAdapters and BindingSources were added via the GUI tools. Your suggestion did push me to what may be an explanation for the IDE behavior. I had recently embedded my DB ConnectionString in my application code as opposed to allowing it to be stored in app.config. It appears that the IDE requires that the ConnectionString be in the usual default location(s) and it doesn't complain if it doesn't find it. So when it came time to set the BindingSource.DataMember property, it didn't complain about no DB access, instead it referred outdated info it had stored in some unknown (to me) location. In short, when I put the ConnectionString back in app.config, the IDE allowed me to set the property.
| | Old Mr.Ed Thursday, July 16, 2009 6:33 PM | Hi Old Mr.Ed, Based on my test, when you set the DataSource to the special table in the DataSet, you cannot see any DataMember listed there, if you set DataSource to the DataSet, you can see the table listed in the DataMember design list. Sincerely, Kira Qian Please mark the replies as answers if they help and unmark if they don't. | | Kira Qian Friday, July 17, 2009 7:34 AM | We are changing the issue type to “General Discussion�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by opening the Options list at the top of the post editor window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions. Please mark the replies as answers if they help and unmark if they don't. | | Kira Qian Wednesday, July 22, 2009 6:38 AM | Hi Kira Sorry for the delay. Murphy's Law seems to interject itself at the most inopportune times and I had divert my attention for a few days. This question can be closed. As I had mentioned in my last reply, the IDE misbehavior seems to be related to my changing where the DB ConnectionString was being stored. It would appear that the IDE wanted the ConnectionString in the standard location(s) in order to update itself with changes in the database. When I returned the ConnectionString to its standard place, the IDE worked as it should. I can live with that during development. When development is complete, I can move the ConnectionString back to where I want it. Thanks again and please accept my apologies for the excessive delay.
- Marked As Answer byKira QianMSFT, ModeratorWednesday, July 29, 2009 2:14 AM
-
| | Old Mr.Ed Tuesday, July 28, 2009 4:18 PM | Hi Mr.Ed, Never mind. If you have any question in developing, you are warmly welcome. Sincerely, Kira Qian Please mark the replies as answers if they help and unmark if they don't. | | Kira Qian Wednesday, July 29, 2009 2:15 AM |
|