I have installed nopCommerce 3.5 on visual studio 2010 but after a successful configuration i could not find any database connection string file which should be under Nop.Web/App_Data/Settings.txt. so there is no Settings.txt file in my project at all and I am using MSSql 2012, Database has been created as expected including sample data. so where is my database connection string please?
Thanks for your time and help
Just create a file called "Settings.txt" in App_Data and copy the following 2 lines in it. You need to modify the connection string to suit your environment. I have replaced my details with capitals.
DataProvider: sqlserver
DataConnectionString: Data Source=SERVER_NAME\DB_INSTANCE;Initial Catalog=YOUR_DB_NAME;Integrated Security=True;User ID=USERNAME;Password=PASSWORD;MultipleActiveResultSets=True
refer this post : http://www.nopcommerce.com/boards/t/34563/where-is-database-connection-string-settingstxt-on-nopcommerce35.aspx
Its actually there, I had the same issue just now after installing 3.5 and wanting to point it at an existing db, but not being able to find settings.txt and wondering if it had been moved to web.config or something more usual.
What you need to do is highlight presentation > nop.web > App_Data and then click show all files in the solution explorer. there you will see Setting.txt . Right click it and select include in project and you are good to go.
Related
Usually connect to an external database but I wanted to fiddle with creating a project with a local database. I am using SQLServer Express Local Database, not CE.
I can add tables with EF but if I right click on Tables in Server Explorer the only options I have are Refresh and Properties, i.e. no Add Table menu option. Similarly, if I right click on one of the tables EF has created I also get only the Refresh and Properties menu options so I can't add rows, etc. Same problem with stored procedures; I can't add any (should I want to do some testing with EF and stored procedures) because I only have the Refresh and Properties menu options.
FOLLOW UP:
I have isolated this problem to VS2012 Professional. When I use VS2010 it works exactly as expected: I can add tables and stored procedures. Following the same steps with VS2012 results in the situation where there is no menu option to add either tables or stored procedures. I produced these test results with SQLServer 2012 LocalDB.
If you only see Refresh and Properties when you right click on Tables in Server Explorer, you probably need to install SQL Server Data Tools from http://msdn.microsoft.com/en-us/data/hh297027 .
I had a similar problem only with Visual Studio 2012 Express for Web following along with the "Getting started with ASP.Net MVC3" at www.asp.net. The tutorial used a Sql Server Compact edition but I have SQL Express 2012 so I changed the connection string to have the data source point at my local instance, .\SQLExpress2012. The app worked fine and was able to read and write to the database. However I could not edit the database in the Visual Studio Express Database Explorer (all the context menu options were missing except "refresh" and "properties).
I found that changing the data source in the connection string to "Data Source=(LocalDB)\v11.0;" fixed the problem. I read somewhere that if you use LocalDb instead of the SQL Server instance name then it will be accessed under your user account - must have been some kind of permissions issue.
The whole (working) connnection string is:
"Data Source=(LocalDB)\v11.0;AttachDBFilename=|DataDirectory|Movies.mdf;Integrated Security=True;"
Hope this saves someone a bunch of hours pulling their hair out, I'm almost bald now :)
I found that when installing Visual Studio 2013, I had not requested the 'SQL Server Data Tools' feature.
By re-running the installer from 'Control Panel' > 'Programs and Features', using the 'Modify' option, I could add the missing feature. On completion, the 'Add New Table' menu item was available.
I am trying to run a crystal report from my web application which was built using ASP.NET 4.0 and Visual Studio 2010. I have installed the following from the SAP site (http://www.businessobjects.com/jump/xi/crvs2010/us2_default.asp)
1) SAP Crystal Reports, version for Visual Studio 2010 - Standard EXE installation package which installs the software into the Visual Studio IDE.
2) SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit)
I have a page called Reports.aspx in which I have a crystal report viewer control
<CR:CrystalReportViewer ID="rptViewer" runat="server" AutoDataBind="true" />
In the Reports.aspx.cs file I have the following code:
protected override void OnPreRender(EventArgs e)
{
ReportDocument report = new ReportDocument();
var path = Server.MapPath("Reports/Sample.rpt");
report.Load(path);
report.SetDatabaseLogon("username", "password", "servername", "databasename");
rptViewer.ReportSource = report;
}
On the report.Load(path) line I get the following error:
Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack.
How can I fix this?
I also got into the same problem my problem was report path was not valid, May be you have same problem , check Server.MapPath("Reports/Sample.rpt") returning valid path ?
make sure the report is in app_code folder
initialize a new instance of it instead of initializing a reportdocument and loading the report in it.
Sample report = new Sample();
this worked for me
You will need to modify two properties in the .rpt files:
Build Action is set to "Embedded Resource" by default. Change it to "Content".
Copy to Output is set to "Do not copy" by default. Change it to "Copy always".
Rebuild, Build deployment package and Publish. Done!
NOTE: Below, the term "WebSite" refers to actual web site nodes in IIS, NOT a virtual directory within a web site.
Problem Root Cause: There is no "aspnet_client" folder accessible by the application.
This can happen for several reasons:
Since the SAP CR installer appears to install the aspnet_client folder in the ...\inetpub\wwwroot\ folder, if your Web Site physical path is NOT ...\inetpub\wwwroot, your application will not have access to the aspnet_client folder.
If the aspnet_client folder was moved or deleted from to the top level of your web site's physical path, your IIS application will not have access to the folder.
Problem Solution (For Windows Server 2008 R2)
Go to the IIS manager on your server
Expand the tree view node for the WebSite running your application
Look at the level immediately under the web site node and ensure you see a "aspnet_client" folder.
If you do see the folder, then perhaps this root cause is not the cause of your problem.
If you do NOT see the folder, search the server's hard drive for it and COPY it to the Web Site's Physical path.
Right mouse button click on the Web Site node and click Refresh from the popup Menu
You should now see the aspnet_client folder at the level directly under your web site node and the reports in the application should work.
I ran into this when I converted a web site to a web application. The report would run fine on my dev machine, but not on the server. Then I realized the rpt file was missing on the server!
By default the report files were considered embedded resources and were not copied when the web application was published. I just changed them individually, republished the site, and all was well again.
I have also had a report load failure if I have mistakenly left the report file open in crystal reports designer.
This error is a real treat, and seems to have many possible antecedents. Fortunately I only wasted a day on my particular variation:
ReportDocument.Load() also makes a local temp copy. (This may only be in the case of a load from a network drive location, I didn't test this in the case of a local load.)
If the user context under which the load occurs does not have authority to create the temp file locally, Load will fail with the same very unhelpful error.
Also, I ended up diagnosing this with Process Monitor. It may be helpful for you as well.
Please make sure your report rpt files are in their original folder. I got the same error first, after I "published" my MVC web site to IIS. I didn't realize that "Publish" didn't put rpt files in the package.
Re-install the "Crystal report engine" to the server
Build Action set to "Content".
It perfectly worked for me..!
I am building a web application using VS 2012 MVC4 code first. In order to recreate the .mdf file after I changed the model, I manually deleted the file from the app_data directory in VS. I have done this a few times before without any problem.
Now I receive an exception:
The underlying provider failed on Open. ==> Cannot attach the file
MYDB.mdf as database 'MYDB'.
I will appreciate your help on how to recreate the .mdf file.
Thank you!
That what fixed it for me,
From Package Manager Console run these commands:
sqllocaldb.exe stop v11.0
sqllocaldb.exe delete v11.0
And then:
Update-Database
Use SQL Server Object Explorer to delete the database rather than just deleting the .mdf file in Solution Explorer. Otherwise the SQL Server instance still thinks the database name is used and the next time you try to attach a database to the same name it won't work. See the section on Initial Catalog in this MSDN page:
http://msdn.microsoft.com/en-us/library/jj653752.aspx#initialcatalog
Try deleting it again from SQL Management Studio. It'll complain that there's no physical file any more but will remove from the object browser (You'll see after you refresh it)
Remove this line from the connection string that should work ;)
"AttachDbFilename=|DataDirectory|whateverdatabasename-20130917064511.mdf"
exit localhost iis express and try again.
I delete my DBContext class and re created it again in my MVC Project. Then .mdf file is re created in App_Data
Hi i have a working app that uses an attached mdf file with the following connect string :
<add name="SqlDataContext" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=true;User Instance=true;AttachDBFilename=|DataDirectory|\WPCloudApp26.mdf;Initial Catalog=WPCloudApp26;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
I am using a Windows phone cloud application template and i have azure storage emulator running on my pc
everything works fine, until i do the following steps for the first time:
i want to view the database so i double click the app_data/WPCloudApp26.mdf file through visual studio when the app is not running. when i double click it, the db opens up under data connections in the server explorer pane and i can see the database and all the tables. so far everything good
I am done viewing the db, so i close the connection by right clicking --> close connection.
i want to run the app again, and when i run it all hell breaks loose. i get the following error message:
One or more files do not match the primary file of the database. If
you are attempting to attach a database, retry the operation with the
correct files. If this is an existing database, the file may be
corrupted and should be restored from a backup.\r\nCannot open
database \"WPCloudApp26\" requested by the login. The login
failed.\r\nLogin failed for user 'NT AUTHORITY\NETWORK
SERVICE'.\r\nLog file 'C:\Users\michael\Documents\Visual Studio
2010\Projects\WPCloudApp26\WPCloudApp26\WPCloudApp26.Web\App_Data\WPCloudApp26.ldf'
does not match the primary file. It may be from a different database
or the log may have been rebuilt previously.
the exception is thrown on the method var firstItem = context.SqlSampleData.FirstOrDefault();
Thats it, no matter what i do, i can't run the app again. this is driving me crazy since the only thing to help is to create a new solution with a different name (thats why i got to number 26)
What is going on ? why is this happening only after the first time i try to view the database in visual studio ?
Edit
i have noticed that changing the initial catalog and mdf file in the connection string solves the problem. So where are the remnants of the db name are saved ? how can i clean up old leftovers ?
You shouldn't try to open a .MDF file that is attached to SQL Server Express. It will probably break the consistency between the .MDF and the log file.
Connect to the SQL Server Express server using the Server Explorer, or SQL Server Management Studio. (There's a free version of it for Express as well)
If you really want to open the .MDF in Visual Studio, then detach the DB from SQL Server Express first.
I am currently going through the MvcMusicSore tutorial (MVC 3). I have full sql server 2008 installed and created a local database by running the SqL scripts included in the MvcMusicStore-Assets data folder. However when trying to add the mdf to the AppFolder in Visual Studio 2010 I get the error Access Denied. I am completely stuck at this point and would appreciate any help to resolve this.
Most probably the mdf file is locked by some other process, not allowing the application to read it. If you mounted the database on SQL Server you need to use a connection string with the machine name instead of specifying the mdf file directly.
You can't copy or modify a live working database. And I don't see why you should.
You need connecting to it? Pick a way. LINQ to SQL, Entity Framework, NHibernate, ADO.NET...
If you really want to copy the database file for some reason, you must first stop the MSSQL Service (or detach the database), then do that.
Like others have said, you shouldn't need to add the actual .mdf into your project. If you have it running on your local SQL Server instance, you should be able to add it via Visual Studio's Server Explorer (plus that gets you your connection string).