Cannot update model after adding stored procedures to database - asp.net-mvc

I am working on a MVC 4 application.
Using Entity Framework Database First design paradigm.
My database is in mySQL, on a remote server.
I am using the mysql connector 6.6.5.
I am using Visual Studio 2012 with updates installed just two days ago.
The problem: I created my tables and then generated the model. After that I created some stored procedures and then updated my model by rightclicking the model diagram and then selecting "Update Model from Database"
In the next dialouge box I then select my new stored procedure. But some stored procedures are not being generated in my model. (I cannot see them under Function Imports in the Model Browser.). Even if I generate the model one more time, no success.
For stored procedure I get this error when generating model:
An exception of type 'MySql.Data.MySqlClient.MySqlException' occured while attempting to update from the database. The exception message is 'No data - zero rows fetched, selected or processed'.
Funny thing is I tested the stored procedure from MySQL workbench. The stored procedure works as expected.
Please help!

Related

Stored Procedure Failing to Insert to a Table, No Errors Given

Im working on an azure database just adding a couple of Stored Procedures and just making sure the program I'm building with it in .NET is all aligned properly.
I'm not going to go into the Stored Procedure itself nor the Program I'm developing because I don't believe the problem is there, I have a Development program and database which is using the exact same code and they work fine, I'm using Microsoft's SQL Server Management Studio to handle everything on the servers side.
The only difference to the current setup is that I myself scripted a bunch of the Stored procedures and a single View of a table that I did not create....(I did not create the table, but I made a view for it which is a slightly different format)
The person creating most of these databases and table is one of the database administrators I guess (not Microsoft, but an employee of the company using their services), I on the other hand am a freelance programmer and I'm guessing I have somewhat limited access to the server (limited credentials).....although it's allowing me to do more or less anything I need to do like creating SP's etc.
My current (and only problem) is a single stored procedure that runs through without an error does not update the table (the table i did not create) the Stored Procedure just inserts a couple of records and then deletes a record from the same table.......
It deletes the record just fine but for some reason the INSERT doesn't insert anything.
Again, this works fine on another Development database and the programs are sending the exact same strings but this new database just doesn't want to play along.....
Could this be a permission problem I'm having between my stored procedure and the table I did not create?
I would love to dump this onto the admin guy (and already did but he dumped it back on me haha) so I just want to be sure I'm not wasting his time....... and give him something solid to go on.
Thanks for your help Paul S.

Get Details of Deleted Stored Procedures and Functions of DB2

I want to get the details of the Deleted Stored Procedures and Functions
Also i want to get the info like when it was created & removed in DB.
Please guide me.
Thanks in Advance...
You can see when procedures and functions were created by looking at the CREATE_TIME column tables in the system catalog like SYSCAT.PROCEDURES and SYSCAT.FUNCTIONS.
You will have no way of knowing when these objects were dropped unless you enable auditing within the database (and review the audit logs to find instances of DROP PROCEDURE or DROP FUNCTION).

Firedac / Anydac query issue when using updatesql components

The following question is related to firedac using adquery, updatesql with access database:
First the scenario:
In one of scenario my updatesql gives an error i-e data in the table was not updated, however my dataset after showing error moves to next record. But now data is not in sync with table grid, which is based on this dataset*(adquery)* show updated version which was not successfully applied.
Yet the table still has the old version of the given record.
And my question:
If an error occurs during modification how to know that modifysql
was not run successfully and trap that error to refresh the dataset
as per data in table?

Core Data: Import values from old database

I'm upgrading the current version of a dictionary app. The new version of the database has new schema and is prepopulated with new data.
However, there is a single attribute value I would like to add from the user's version of the database for about 12000 records found in 3 of the entities.
Edit: These are values that were created throughout use of the app, so I can't simply overwrite the previous database. I was hoping it was possible to load the new database, and then update certain values using data from the user's version.
How should I do this?
I need to load two versions of the dictionary with different model versions into memory and transfer across. Is this right?
You need to perform a core data lightweight migration. check for a tuto on the web if required - very simple
You can save with your project an sqlite or xml (depend on size of data) with data to be updated - OR - you can download from a web service of your own, the required updates.

MVC 4, membership/profile and aspnet_resql

I am developing an MVC 4 application. I am working on the membership authentication and profile module, and I am a bit confused.
I am confused because it seems that there ar TWO sets of Authorization/Profile modules working behind the scenes:
Short Version
There are TWO sets of tables for Authorization: one created when you create a new MVC 4 Internet application
The second is created when you run aspnet_regsql.
Data is saved and feteched from the two sets in a confusing way.
How are the two sets related:
What is saved where?
Why are Users created in the two sets?
etc.
Long Version
Set 1
I created a new MVC 4 Internet project. It was generated with the ability to register users and create roles. The database that was automatically generated contained the following tables: Users, Roles, UserInRoles, Memebership, Profiles.
There were no stored procedures.
The Authorization worked OK: Users data and roles were correctly saved in Users, Roles and UserInRoles tables.
Set 2
I then moved on tp add Profile for the site users. I followd Joel's answer. When running the code hit this line:
AccountProfile.CurrentUser.FullName = "Snoopy";
I received this error:
Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.
I ran aspnet_regsql against the database created earlier, and the expected set of aspnet_ tables and stored procedure was created.
Tested my code again.
This time it worked OK and the profile property was saved OK to the aspnet_Profile table (whic is to be expected).
In the next step I created a new user. The user was created in BOTH Users and aspnet_Users tables (with different UserId values) -- please see here picture 1
Added the property FullName=Snoopy to his profile.
Running Membership.GetUser().ProviderUserKey returns the UserId from table Users.
Running AccountProfile.CurrentUser.FullName returns "Snoopy".
Please see here picture 2.
This very surprising because it means that somehow the system knows how to relate a record from table Users to a record in table aspnet_Profile where the UserId field is from table aspnet_users.
BTW, I verified that table Profiles is empty so the value was not feteched from there.
So what is going on here?
Is this behavior the expected behavior?
Or is Jole's answer wrong in the sense that there some other (better?) way to implement Profile in an MVC 4 application, and what I did is to throw a wrench in the works?
You should probably use one or the other. Here's a recent post to help you decide:
http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx

Resources