I am seeing the following error in LINQPad (typeloadexception in first screenshot):
Here are the connection properties:
The 'Test' button works as expected i.e. it prompts: "Successful". What is the problem? Here is the web.config in the app:
<add name="AdventureWorks2012Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=mypc;initial catalog=AdventureWorks2012;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
I have read a few answers on here, which suggest setting the assembly to 32 bit etc.
Your custom assembly is named LINQPad.dll, which is likely to get confused with LINQPad.exe. You will need to change the assembly name in Visual Studio's project properties dialog.
Related
So I have to update an old .Net application for my job.
When I open the application's DataSet and want to update one of the tableadapters, I end up with this type of "bug" :
the problem in question
leading to this other problem
How CommandText is :
with semicolon 1
How it should be :
normal
I have found a page about this topic but it doesn't help me much, because I can't reinstall the SQL Server in my situation :
https://answers.sap.com/questions/5936797/what%27s-with-the-semicolon-1-notation-in-stored-pro.html
Do you have any idea how to resolve this problem ?
Edit:
Application is VB.Net Framework 4.5.2
SQL Server 2016 with a database compatible with SQL Server 2008
I've found the answer !
Problem : The ConnectionString was using System.Data.Odbc
<add name="myApp.My.MySettings.myConnectionString" connectionString="Dsn=myDataBase;app=myAppProd;database=myDataBase;trusted_connection=Yes" providerName="System.Data.Odbc" />
Solution : I switched to System.Data.SqlClient
<add name="myApp.My.MySettings.myConnectionString" connectionString="Data Source=mySQLServer;Initial Catalog=myDataBase;Integrated Security=True" providerName="System.Data.SqlClient" />
Everything works as excepted !
Hope it helps others encountering this same problem
Edit: Had to make another DataSet because it keeps auto-generating code with Odbc component even after updating the ConnectionString...
I am in the process of creating a blog site from scratch using MVC 3.0 and the Entity Framework. I am using a SQL CE .sdf file for the data store. This is stored in the projects App_Data folder. Locally, everything works fine. Not a problem. The .sdf file is read and processed without error. However, after using Web Deploy to publish to a shared hosting provider, I get the following error when trying to view the remote site:-
Access to the database file is not allowed
The connection string I am using in web config is:-
<connectionStrings>
<add name="DataAccess.BlogDbContext" connectionString="Data Source=DansMVCBlog.sdf" providerName="System.Data.SqlServerCe.4.0" />
</connectionStrings>
I have researched the problem and have hit a brick wall. Suggestions have included adding App_Data/DansMVCBlog.sdf to the connection string file path rather than just the file name. This does not work as you are advised the file path is invalid. On the shared hosting control panel, I have set read/write permissions on the App_Data folder to be true. Also, in my Global.asax file, I have disabled
`Database.SetInitializer(new DataInitializer());
Am I making a schoolboy error here? Does anyone have any suggestions? Thanks
Looks like the OP may have solved their problem but in my case, it turned out that the database file had been marked as Read Only by my source control system. Clearing the Read Only flag solved the problem.
You probably need to update your connection string
<connectionStrings>
<add name="DataAccess.BlogDbContext"
connectionString="Data Source=|DataDirectory|DansMVCBlog.sdf"
providerName="System.Data.SqlServerCe.4.0" />
</connectionStrings>
Who knows what the solution to this was. All I can say is I was having problems publishing using web deploy, so I switched to using ftp. After that everything worked just fine.
I'm using Visual Web Developer 2010 Express to learn ASP.NET Web Forms using the tutorial at W3 Schools. I'm currently stuck on the database section of the tutorial, located here. Under the heading, "Add Database Records", I am told to right-click on the Movie table in the Database Explorer and select the "Show Table Data" option, but when I do, I get the error, "Operation is not valid due to the current state of the object", with no other information. This error also occurs when I select the "New Query" option from the table's context menu.
I have tried adding the MaxHTTPCollectionKeys attribute to the web.config file as shown here, in the form of
<appSettings>
<add key="aspnet:MaxHttpCollectionKeys" value="5000" />
<add key="aspnet:MaxJsonDeserializerMembers" value="5000" />
</appSettings>
, but it has not helped. The error has nothing to do with code and is entirely GUI-based, or so I believe. Any help resolving this error will be welcome.
My Asp.Net MVC project works on local machine without any problems. And, in my project, I use membership provider.
After I publish my site, some parts work correctly. However, membership system does not work. And error message is "Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'."
My Connection String is like this;
<add name="ApplicationServices" connectionString="Data Source=111.111.111.111;Initial Catalog=DBname;Persist Security Info=True; User Id=123123;Password=pass;" providerName="System.Data.SqlClient" />
<add name="DATABASE" connectionString="metadata=res://*/Models.Model.csdl|res://*/Models.Model.ssdl|res://*/Models.Model.msl;provider=System.Data.SqlClient;provider connection string="data source=111.111.111.111;Initial Catalog=DBname; User Id=123123;Password=pass;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
user login and register functions , which uses "ApplicationServices", does not work.
But, other functions, which connect database with "DATABASE", works correctly.
You will need to allow the application to show you errors.
"Sorry, an error occurred while processing your request." is a default message.
In your web.config (Under system.web) add the following.
<customErrors mode="off" />
Then report back with the error message you receive.
======= In Response to the Edit
The error is simply telling you that you havent imported one of the stored procedures. Make sure you've exported it from local (Via Generate Scripts or Backup).
Hey everyone and thanks for taking the time to help.
I am stuck on this problem. I have an asp.MVC application and my client want to use nopCommerce for the shopping cart. I made a test MVC application and got the sub-application working great on a simple demo. The nopCommerce virtual directory is registered as an application in IIS and it runs fine in the demo. However when I try integrating the steps into my application I get a run-time compilation error:
CS0246: The type or namespace name 'Combres' could not be found (are you missing a using directive or an assembly reference?)
Line 56: <add namespace="System.Web.WebPages" />
Line 57: <add namespace="System.Web.Helpers" />
Line 58: <add namespace="Combres" /> <-----Error Line
Line 59: </namespaces>
Line 60: </pages>
The sub-application (nopCommerce) does not use Combres so I thought it was an inheritance issue so I did the location trick in the parent Web.Config file:
<location path="." inheritInChildApplications="false">
<system.web>
...
</system.web>
</location>
This got rid of the compilation error, but now there is no compilation of the file, the .aspx files just download to my computer instead of being executed. The main MVC application still runs great, I only get this downloading issue when I try to run the nopCommerce application. I am completely stumped, I am kind-of an IIS noob and am having to learn quick.
K found the answer to this. My companies platform, we use ASP.net MVC, was turning all requests with file.* into download requests. So what I wrote was working great, it was doing what is was supposed to...I just didn't know.