Update entity data model from database - asp.net

when i update the database with some new relationship between tables, is there a way to update the edmx file as well?
(when i click update model from database, seems nothing changes)

Open .edmx file in Visual Studio and then simply right click on "Update model from database" and then select any table you need from the Add tab.
If nothing else works you can simply select all the tables delete them and then do the procedure mentioned above.

Right click on the designer and select "Update model from database". Then use the "Refresh" tab to pull any additional information down.

Related

how can show all table in db in sql dataSource in asp.net

I work asp.net and use "aspnet_regsql" for manage user and role .. but i have a problem with work 'data source'.
in 'data source' only show views in database and all table hidden.
I want to know is how the table will be displayed in the list.
please see 2 image in comment.
all table and data source configuration
All tables in your database are asp.net created tables, they don't show up in the list of available tables, try adding your own table to the database and see if it shows up there.

"Unretrieved" value in the table field

I have form with several controls. When I fill these controls all of them are saved correctly in the datasource table except of one realEdit control. It says "Unretrieved" in the table. I have set it's datasource and datafield properties correctly, so what can be a reason of it and how to solve it?
"Unretrieved" fields are newly created fields which AX 2012 AX by error treats badly. It may also appear if a form query does not contain a field in the datasource field list.
You problem is solved by restarting the client or the AOS or both. Or in the second case just add the field to the query field list.
1.- Recompile and restore table. Check fields with Table explorer; if table explorer doesn't show your field(s) properly, certainly ypur form won't do. So, if this fails, goto 3
2.- Recompile and restore form. Generate incremental CIL. Check it. If fail, goto 3
3.- Restart Ax client and retry steps 1+2. If fail, goto 4
4.- Restart AOS. Retry steps 1+2.

How to automatically generate parameters in an ASP.NET DataSource Update Command

I'm using ASP.NET forms to build some quite lengthy questionnaires. I'm creating each page using a FormView control with an attached SQL dataSource. The select query is easy enough- Visual Studio generates:
(select * from table)
but for the update query, Visual Studio gives me:
UPDATE table SET field1=,field2=... etc.
and I need:
UPDATE table SET field1=#field1,field2=#field2... etc.
At the moment, I'm copying each field name, pasting it after the = and adding an '#', but this gets really tedious.
Is there a way of automatically adding a parameter for each field?
OK, found the solution now.
Click 'configure DataSource' on the SmartTag
On the 'Configure the Select statement' page of the wizard, choose 'Specify tables from a table or view
Click the 'Advanced' button
Select 'Generate Delete, Insert and update Queries'
NB, for this to work, your select statement must contain the Primary key of the table.
Using Third party Tool SSMS tool for Autogenerated StoredProcedures in MSSQLServer
It's Generated Insert,Update,Select,Delete Query with Parameter Use in DB

ASP.NET:Enable Delete facility in Entity Data Source

I have created a Grid View that use Entity Data Source as its Data Source.
I used Command Text in my Entity Data Source because i have to join two tables for displaying data in grid view.
But Command Text cannot be set if Enable Delete, Enable Insert, or Enable Update is enabled. so i disabled them.
But i need to use delete facility. How cloud i do that ?
Perhaps you forgot set primary key in database

How to update entity objects without deleting?

I have an entity generated from my database that contains one table. When i make changes in the DB i obviously would like these changes to reflected in my model.
My current approach is to delete the item from the designer and then right-click - update model from database. This works for me at the moment. Is there a different approach to refreshing these entity tables ?
Why are you deleting them? You can simply right click on your model and select Update Model From Database... and you are done.

Resources