Problem with Access
-
Hello everybody, i'm writing here because i'm really becoming crazy, i read every kind of internet pages but I'm not able to find a solution but i'm also sure that the solution is behind the corner. I have an Access database with different tables. The main table has different foreign keys to other tables. I do an example with 2 tables to make the problem easier: Table Products Field1 - Primary Key: Product Code - text Field2: Description - text Field3: Product Type - integer Table ProductTypes Field1: Primary Key - ID - integer - FK on Field3 of "Table Product" Field2: Description - Text Now, I open Visual Studio, I add my database and I drag&drop the table "Product" on my Windows Form as a DatagridView. The wizard create for me, the tableAdapter, bindinsource ecc.... If I start my app the DatagridView is populate with the correct data but in the column "Product Type" I see the number from the PK of the table "ProductTypes" while I'd like to see the Description. I created a new TableAdapter query that give me the result i want to see but when I confirm I get the message that i'm created a query that give a different result from the original schema. If I continue the query is created but i'm not able to retrieve data using this new query. THe only way I've to retrieve datas as I want is to modify the original Fill query but in this case the relation between the 2 tables will be removed and also the TableAdapter Insert method will be removed. So, I will see the data in datagridview as i'd like to see but I don't have anymore the insert method. Can someone help me by telling I could I retrieve the data in the way I desider without losing the chance to insert new record in the table? Thanks Giacomo
-
Hello everybody, i'm writing here because i'm really becoming crazy, i read every kind of internet pages but I'm not able to find a solution but i'm also sure that the solution is behind the corner. I have an Access database with different tables. The main table has different foreign keys to other tables. I do an example with 2 tables to make the problem easier: Table Products Field1 - Primary Key: Product Code - text Field2: Description - text Field3: Product Type - integer Table ProductTypes Field1: Primary Key - ID - integer - FK on Field3 of "Table Product" Field2: Description - Text Now, I open Visual Studio, I add my database and I drag&drop the table "Product" on my Windows Form as a DatagridView. The wizard create for me, the tableAdapter, bindinsource ecc.... If I start my app the DatagridView is populate with the correct data but in the column "Product Type" I see the number from the PK of the table "ProductTypes" while I'd like to see the Description. I created a new TableAdapter query that give me the result i want to see but when I confirm I get the message that i'm created a query that give a different result from the original schema. If I continue the query is created but i'm not able to retrieve data using this new query. THe only way I've to retrieve datas as I want is to modify the original Fill query but in this case the relation between the 2 tables will be removed and also the TableAdapter Insert method will be removed. So, I will see the data in datagridview as i'd like to see but I don't have anymore the insert method. Can someone help me by telling I could I retrieve the data in the way I desider without losing the chance to insert new record in the table? Thanks Giacomo
Can you create a view in Access and use the view?
-
Can you create a view in Access and use the view?
Yes, I already did it. I created a View in Access and then I imported it in my Dataset. In this way I'm able to show the correct data in my DataGridView but the Wizard didn't create for me the Insert, Delete and Update method. Do you think I could be able to update the Access database through the view?
-
Yes, I already did it. I created a View in Access and then I imported it in my Dataset. In this way I'm able to show the correct data in my DataGridView but the Wizard didn't create for me the Insert, Delete and Update method. Do you think I could be able to update the Access database through the view?
A view will only let you see the data. It has been so long since I used Access I can't help you on the inserts, updates, deletes.
-
A view will only let you see the data. It has been so long since I used Access I can't help you on the inserts, updates, deletes.
I think to have solved the problem....maybe I'm using a bad solution but the result is good. In my dataset I have the Main table that is filled with the original database records. In the same datased I inserted a second table that is filled with a my personal Fill query. In my form I have inserted both table adapter. The first one is only in background while the second one is shown in datagridview. I insert, delete and modify the records one the datagrid and when I click "Save", I reflect the changes in the background table adapter.... Thank Giacomo
-
I think to have solved the problem....maybe I'm using a bad solution but the result is good. In my dataset I have the Main table that is filled with the original database records. In the same datased I inserted a second table that is filled with a my personal Fill query. In my form I have inserted both table adapter. The first one is only in background while the second one is shown in datagridview. I insert, delete and modify the records one the datagrid and when I click "Save", I reflect the changes in the background table adapter.... Thank Giacomo
Sometimes, we use an 'ugly' solution until we find a 'nice' one. But, results matter.. if it works, great!