N
nicolasr
Hi,
I'm quite new to database development and am trying
Visual Studio with ADO.NET for the first time (Borland
user before). So please apologize my lack of experience
with the tool. (More precise, I'm using MS Visual C# 2005 Express)
I have two test tables in a JET database. For simplicity say:
Table1: Samples
ID
PersonID
SomeOtherColumn
Table2: Persons
ID
Name
SomeOtherColumn
I created a new data source in VS studio using the mdb file
I created in MS Access before. VS generated typed wrapper
classes for the tables. Then I wanted to automatically create
a simple form for the 'Samples'-table. Since the form should
display Person-Names instead of the PersonID I changed the
control type for PersonID to ComboBox in the DataSource
editor.
Then I dragged the 'Samples'-table to the form. All controls
were generated fine. I then set the DataSource of the PersonID
Combobox to the generated personsBindingSource, DisplayMember
to 'Name' and ValueMember to 'ID'.
Problem:
I start the test application and the database is loaded. (the Samples
table is empty while the Persons table contains a few test persons)
Using the automatically generated bindingNavigator I create a
new record in the Samples table. Now I want to set the PersonID field
in the ComboBox. On drop-down all names contained in the Persons
table are correctly displayed and I can select one of the names.
After that, however, I can't leave the ComboBox!! It looks like
the validation fails and the focus always returns back to the ComboBox.
I can't even close the application.
I thought that given the above mentioned settings ADO would automatically
get the correct ID from the selected name? But it looks more like it
tries to type-convert the selected name to the ID, what fails.
Any ideas?
I should mention that I tried the same with a ListBox instead of ComboBox
and that seems to work correctly!!! I also googled for posts on related
issues
but couldn't find anything that matches this particular issue.
If more information is needed please ask!!
thanks for any help,
Nicolas
I'm quite new to database development and am trying
Visual Studio with ADO.NET for the first time (Borland
user before). So please apologize my lack of experience
with the tool. (More precise, I'm using MS Visual C# 2005 Express)
I have two test tables in a JET database. For simplicity say:
Table1: Samples
ID
PersonID
SomeOtherColumn
Table2: Persons
ID
Name
SomeOtherColumn
I created a new data source in VS studio using the mdb file
I created in MS Access before. VS generated typed wrapper
classes for the tables. Then I wanted to automatically create
a simple form for the 'Samples'-table. Since the form should
display Person-Names instead of the PersonID I changed the
control type for PersonID to ComboBox in the DataSource
editor.
Then I dragged the 'Samples'-table to the form. All controls
were generated fine. I then set the DataSource of the PersonID
Combobox to the generated personsBindingSource, DisplayMember
to 'Name' and ValueMember to 'ID'.
Problem:
I start the test application and the database is loaded. (the Samples
table is empty while the Persons table contains a few test persons)
Using the automatically generated bindingNavigator I create a
new record in the Samples table. Now I want to set the PersonID field
in the ComboBox. On drop-down all names contained in the Persons
table are correctly displayed and I can select one of the names.
After that, however, I can't leave the ComboBox!! It looks like
the validation fails and the focus always returns back to the ComboBox.
I can't even close the application.
I thought that given the above mentioned settings ADO would automatically
get the correct ID from the selected name? But it looks more like it
tries to type-convert the selected name to the ID, what fails.
Any ideas?
I should mention that I tried the same with a ListBox instead of ComboBox
and that seems to work correctly!!! I also googled for posts on related
issues
but couldn't find anything that matches this particular issue.
If more information is needed please ask!!
thanks for any help,
Nicolas