Database project “BaseDatabaseProject” has a single table called “BaseTable.”Database projected “DerivedDatabaseProject” has a single tabled called “DerivedTable” and has a database referenced to “BaseDatabaseProject” where the location is set to “Same database.”Using SSDT for Visual Studio 2012, I right click on DerivedDatabaseProject and select publish. I set the connection to my localhost database and give the database a new name that does not currently exist. If I click the generate script button, I see a script that first adds BaseTable and then adds DerivedTable. When I push databse, my local instance now contains a new database with both tables.
This is not the same result as I have experienced with SQLPackage.exe from SQL Server Data-Tier Application Framework (July 2013). I have been trying to deploy using the SQLPackage and have found that when I do so, it only adds the DerivedTable. Any elements from the BaseDatabaseProject are being omitted. This is evident if I generate a script (the two scripts are otherwise identical aside from the missing part from BaseDatabaseProject) or if I try to publish.The syntax I have been using for SQLPackage.exe is
UPDATE: Using Visual Studio 2012 and SSDT 11.1.50512.0
I am using this code to load a dacpac and get the version number from it:
using (DacPackage dacpac = DacPackage.Load(ADacpacFile)) { retVal = dacpac.Version.ToString(); }
After I install the application on a test machine, this code executes properly and returns the version number on the first run of the application. I can execute the code multiple times while running and retrieve the version number.
Once I exit the application and then reload it, the above code fails with the non-descript error message "Could not load package from 'filename.dacpac'. Stack trace shows: at Microsoft.SqlServer.Dac.DacPackage.Load(String filename, DacSchemaModelStorageType modelStorageType, FileAccess packageAccess).
I have tried rebooting. I have tried manually copying over the dacpac files from the install source. I get the same error every time. The only thing that works is uninstalling the application and reinstalling it. Then it works for the first execution and fails again afterwards.
On my development box, it works every time without error. Only when I deploy the application via install does this happen. I have tried two different boxes (both Win7 64bit) with the same result. The dll's that are being installed with the application are:
Here is my issue I am new to 2005 sql server, and am trying to take my old data which is exported to a txt file and import it to tables in sql. The older database is non relational, and I had made several exports for the way I want to build my tables. I built my packages fine and everything is working until I start building relationships. I remove my foreign key and the table with the primary key will get updated for the package again. I need to update the data daily into sql, and once in it will only be update from the package until the database is moved over.
It will run and update with a primary key until I add a foreign key to another database.
Here is my error when running the package when table 2 has a foreign key.
[Execute SQL Task] Error: Executing the query "TRUNCATE TABLE [consumer].[dbo].[Client] " failed with the following error: "Cannot truncate table 'consumer.dbo.Client' because it is being referenced by a FOREIGN KEY constraint.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
what is the easiest way to deploy a database for a webapp? i have create table scripts but waht is the easiest way to go about inserting data into lookup tables? would i have to write insert statements or is there some other way to do it
I used VWD 2005 Express to create my web application (that uses a sql 2005 database), and now I'm trying to deploy it. I was to understand that all I had to do was to upload all my files to the root folder and the web host's server (webhost4life.com). However, they require me to upload the sql 2005 db to a seperate sql server using a control panel that is very clunky. Does anyone know how to upload the sql 2005 db to the host server or an online tutorial where I could go to learn? Thanks for the help!
Hi, We are using SQL-Server (2005) for the first time and have developed an app that uses 2 dozen tables and a bunch of SP, triggers, etc. How do we get our entities to our client site without a lot of copying and pasting? How about the data we want to upload for lookup tables - how would we get the data there? Moreover, how do we sync stored procedures with the live database as we make changes during development? Thanks, Mark
I have developed a VS2008 .net application using Sql Server express 2005. Running this on my development machine works fine but after i deploy to a client machine i get:
Cannot open user default database. Login Failed for user 'mycomputernameadministrator'
The client machine has sqlserver express 2005 installed using all instllation defaults
My connection string is:
Data Source=.SQLEXPRESS;AttachDbFilename=c:mydatamyfile.mdf;Integrated Security=True;User Instance=False"
I want to be able to deploy my app to any client PC without any database user login (i use my own built in to app) or errors obvoiusly
Could someone give me a step by step to resolve, much appreciated
hi,I was redirect to this URL* based on Deploying a SQL Database to a Remote Hosting Environment,pertaining to my question on how do I convert MDF file to .SQL.I had downloaded and installed the program recommended that is Database Publishing Wizard.but the problem is now, there isn't any context menu "Publish to Provider" * when i right click on thedatabase aspnetdb.mdf..please advice me. thanks.* Reference : http://weblogs.asp.net/scottgu/archive/2006/12/22/recipe-deploying-a-sql-database-to-a-remote-hosting-environment-part-1.aspx
I have a website that uses an SQL 2005 Express database, with the added aspnet_users, aspnet_roles tables etc' inside it. (That is not an .mdf file, but in the databse itself)
Are there any guidelines for moving this kind of database to the deployment server, which also has SQL Express ?
hi, i hope this is the correct forum?i have developed a small asp.net 2.0 web site with vwd using sqlExpress which appears to just bean data file and a log file in my app_data directory. there are two databases, the users one that is created by the login manager and my own that i created to store data. this all works fine on my laptop. i have an xp-pro machine setup with IIS and the frontpage web extentions, i have also installed the .net framework v2.0 on it and done all the windows updates. i have given app_data read/write access for the aspnet and network service users.i used the copy site feature of vwd to install on the xp box and although the site seems to workwhen it needs to bind a gridview to my sqldatasource it gives an error Cannot open user default database. login failed.Loginfailed for user 'rlxpaspnet'Any ideas? i have googled and tried all sorts, but to no avail, so i throw my self on your mercy!Cheers,russ
Hi there. I've created a windows forms app that connects to a sql server express database. now that it's working on my box, i need to install the entire solution on the end user's machine. what's the best way to move the database? I found this article: http://msdn.microsoft.com/en-us/library/ms165716.aspx but i'm wondering if anyone can give me some insights based on your own experience. I'm using ms visual studio 2005 and sql server express 2005. I'm hoping that all i'll really have to do is copy everything over to the new machine and then edit my connection string in the .exe.config file for my app.
I've written a ClickOnce app that deploys a Sql Server Express data file (.mdf) and log file (.ldf) along with the other application files. SQL Express SP2 is a prerequisite for this app. After the applicaiton installs and starts up it copies these files to a specific folder and attaches them by calling the AttachDatabase() method of a Microsoft.SqlServer.Management.Smo.Server object.
This method works fine using Windows XP, however when I run it on Windows Vista I get the following exception:
Microsoft.SqlServer.Management.Smo.FailedOperationException: Attach database failed for Server 'localhostSQLEXPRESS'. ---> Microsoft.SqlServer.Management.Common.ExecutionFailureException: An exception occurred while executing a Transact-SQL statement or batch. ---> System.Data.SqlClient.SqlException: Unable to open the physical file "C:WashMasterDatabasewasshmaster.mdf". Operating system error 5: "5(Access is denied.)".
This exception occurs when I try to programmatically attach the database.
I've searched through the MSDN forums for a solution and I've only found two suggestions:
1.) Create all database connections using a User Instance. 2.) Create the database (using SQL) in the target folder, rather than copying it over from the deployment folder.
I don't like the idea of using User Instances because my entire data access layer is currently written using Ole and I would rather not rewrite it if I don't have to. I cannot find any way to use User Instances with Ole.
I also don't like the idea of creating the database using SQL because it is fairly large.
Here are my questions:
1.) Can User Instances be used with Ole?
2.) Can I somehow programmatically set the permissions of the copied data and log files so that SQL Express can access them without error?
3.) Is there a better method for doing what I'm trying to do or am I destined to have to either rewrite in data access layer so I can use User Instances or create my large database rather than copy it to the target directory?
I have developped an ASP.NET 2.0 webb application localy on my workstation and have the MSSQL2000 database on a server.There has been no problem accessing the database during development. Im now finnished and put the application on a web server. No when i try to access the application i get the following problem as it tries to reach the database: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) I still use the same database so remote connections are allowed and there are lot of application against that sqlserver already running. I have anonumouse access and use a domain service account for the application and that very same account is added as a login to the sqlserver and a domainuser in the database. I have Forms authentication in my web.config file. the connectionstring i use look like this: <appSettings> <add key="app1" value="Data Source=server01;Initial Catalog=database1; Integrated Security=SSPI;"/></appSettings> Can somebody please tell me what is wrong and how to fix it. I dont change any configuration betweeen my workstation and the server in web.config / in pain!!
I have a web app that uses two SQL Express databases. One of the databases is the membership database. I am deploying the app to a hosted environment. Here is my connection string:
Could not open new database 'Akamojo_ASPNETDB'. CREATE DATABASE is aborted. Cannot attach the file 'e:hostingmemberakamojoTournamentLogApp_DataAkamojo_ASPNETDB.mdf' as database 'Akamojo_ASPNETDB'. File activation failure. The physical file name "c:inetpubwwwrootTournamentLogApp_DataAkamojo_ASPNETDB_log.LDF" may be incorrect. The log cannot be rebuilt when the primary file is read-only.
The mdf file is not read only. In the hosted environment the database is on the E drive. In my dev environment the database is on the C drive. From the error message, it appears that when it tries to build the log file it is trying to build it on the C drive in a path that doesn't exist in the hosted environment.
Hello, I would like to deploy a per-machine Express database as part of my VS2005 C# desktop application. The deployment must work with both XP and Vista from the same setup files. I'm not using One-Click installation. I don't want my users to have to configure Express with the Surface Area Configuration tool.
Since the database cannot go in C:Program Files because of Vista ACL issues, I am using COMMONAPPDATACompanyNameAppName as the install path for the database and other user writable application files. In XP this expands to C:Documents and SettingsAll UsersApplication DataCompanyNameAppName and in Vista it is C:ProgramDataCompanyNameAppName. Neither of these paths have write privileges for unprivileged users, so the install program needs to change the write permissions at install time. Right now I am using SetACL ( http://setacl.sourceforge.net/ ), to do that and the install goes fine with write permissions on the companyName folder and it's children for all users.
But I can't connect to the mdf file in my COMMONAPPDATACompanyNameAppName folder. If I am the administrator/installer it works fine, but as an unprivileged user I get different errors, but mostly "Could not login user ...". For debugging, I have also tried installing the database in the "AppFolder" directory (which for my app in both Vista and XP is C:Program FilesCompanyNameAppName) and using "User Instance=true" in the connection string, and the connection is made but (at least on XP) the unprivileged user cannot write to the database because the folder lacks write privileges for that user.
I suppose one thing I could do would be to change the folder/file permissions in the AppFolder, but I am reluctant to do that because I have read that Microsoft does not guarantee that the "Compatibility" feature in Vista for the Program Files directory will be available in future releases/service packs.
So is there a way to do a simple installation/db connection for a per-machine database located in a COMMONAPPDATA path?
I am developing a application where the database needs to be deployed from the central database server which is sql server 2005, and we have only few fields and few new tables which need to be deployed into pocket pc using sql mobile from sql server 2005. We would like to design the database in sql server 2005 for mobile, which will be only structure and will be deployed into PDA using web service.
SQL Database in my application with windows authentication rejects accessing after deploying and remote access 1- My web applications databese access is windows authentication 2- In developing area there is no problem for accessing database 3- After deploying to another server there is problem accessing database: Cannot open user default database. Login failed.Login failed for user 'BRCK231ASPNET'. How can I solve this problem? Thanks.
ALTER FUNCTION [dbo].[f_spn_GetCustomerNo] ( -- Add the parameters for the function here ) RETURNS int AS BEGIN RETURN 12441 END
This function is used as the default for a Customer_No column in every table. Now I want to change the UDF to RETURN 11564 but when I attempt to Alter Function I get the error:
Cannot ALTER 'dbo.f_spn_GetCustomerNo' because it is being referenced by object 'DF__tm_spn_eq__Custo__5C6CB6D7'.
which is a table that is using the UDF as a default. Is there any way around this with the exception of removing the default from every table, changing my function, and then resetting the default?
Hello, this is an error I've gotten today when trying to expand system tables such as master and msdb in Enterprise Manger: The instruction at "ox418561c4" rferenced memory at "00x00000034". The memory could not be read. I have no clue what it means. I did delete about 45 mg of .TRN files from a log directory on the server. Could it be the result? What's my next step? thank you again
In our application we use three database(access, sql server and oracle) to store configurations. We use a program to copy the configuration from one database to another. We use ODBC and MFC recordsets to do the copy. We recently updated the application and changed the the table schema's. Before we had two tables which each had a schema of one long as key and one image field. Now we have one table with one long as key and three image fields. Now when we copy to sql server from access we get the error " Invalid locator de-refrenced" when we have large data (about 1 MB) in one image field. Before the change in schema's we did not have this problem with an image field with a large amout of data. We are using the sql server odbc driver.
I am trying to copy data from one SQL server to another. The data contains big image or texts. After SQLGetData, we used the SQLPrepare, SQLBindParameter, SQLParam and SQLPutData, and SQL_LEN_DATA_AT_EXEC to insert the data.
Our application is unicode based, but the data type in the SQL server is text, so we bind the paramter using SQL_C_WCHAR as C type and SQL_LONGVARCHAR as sql type. But we got the error:
Microsoft claims it has this problem when using the MDAC2.7, see http://support.microsoft.com/kb/325765, but with a different error message.
The SQL server ODBC driver we are using is 2000.85.1117.00, but I got "Invalid locator de-referenced", Not sure if it has been resolved completely or not?
I am trying to modify a function used as default value by many tables but I get the following error:
Cannot ALTER 'dbo.fn_GetDate' because it is being referenced by object '...'.
First, can someone explain me the reason behind this behavior? Why can't the function be altered?? I did the following test: I create a table with a default value of dbo.fn_GetDate_r(). fn_GetDate_r() simply returns the value of another function fn_GetDate(). Result: I can alter fn_GetDate() without problems...
Like I said, the function I want to modify is used by many tables. Is there a simple way to alter it? The tables don't appear in the dependencies and SQL Compare doesn't seem to be able to detect and drop/recreate the constraints...
I'm creating a script task that needs to reference the Visual Studio Team Foundation Server assemblies, but I'm unable to setup a reference. (Note: the Team Foundation assemblies are part of the VSTS SDK installation.) When designing the script, if I select Project, Add Reference, the .net assemblies for the Microsoft.TeamFoundation namespace are not listed -- even though the assemblies do show up if do the same in a Visual Studio.Net project for C# or VB.
I've also tried to add a reference in a Custom Component Set -- View, Object Browser, Browse, Edit Custom Component Set, and selected a specific assembly. But I get the following error:
--------------------------- Microsoft Visual Studio for Applications --------------------------- The following components could not be browsed:
C:Program FilesVisual Studio 2005 SDK2006.09VisualStudioIntegrationCommonAssembliesMicrosoft.TeamFoundation.dll
Why can that .dll be referenced in standard VB.Net or C#.Net apps, but not in an SSIS script task?
I am migrating data. I found a strange thing in the existing table, there is a column named workshopCaseID in a TruancyCase table ,The datatype for workshopCaseID is an int (null). it is a FK, there are some records are 0 values, but the fk referenced primary table only have 1-8 values, how are the 0 values get inserted there?
The parent table has the column OrderID which is the primary key. There is a unique non-clustered index in the same table with the same column and some included ones. A child table references the parent table on the OrderID column. Unfortunatelly, in the sys.foreign_keys table the index that has been used to acomplish the referential integrity is the unique non-clustered one instead of the primary key (which is the clustered index as well).
This is causing issues in some maintenance tasks where we need to disable all the indexes of the table apart from the clustered index. Disabling these indexes leeds to disabling the not properly configured foreign key as well. Maybe dropping the index create the constraint again and then recreate the index is a workarround but I wish to have something more elegant and future proof.
I have a "case" table describing what type of social worker case and who performed work on the case. Four case workers are referenced within each case and all workers belong to the "worker" table. I am trying to present the case worker name on a detailsView rather then the much simpler task of showing the worker's index stored within the case. I can't seem to get the correlation names working.
SelectCommand="SELECT [ReportID], [RecCreated], tblVCaseType.Description AS cType, [IntakeDate], tblVCounty.Description AS County, [Abuse], [Neglect], [Dependency], [AfterHours], [Screenout], tblVScreenOutcome.Description AS Outcome, [Closed], [ClosedDate], iWorker.[Worker Name], cWorker.[Worker Name] , tblVAssessmentType.Description AS aType, tblVTimeframe.Description AS tFrame, tblVDisposition.Description AS Dispo , tblVProgramXfer.Description AS Xfer,
[Code] ...
Getting only one worker name is easy. But, I need all four. I have tried many versions without success. The error from this version is repeated 4X:
The multi-part identifier "tblVWorker.ID" could not be bound.
I am running Final Relase of 2005 version 9.00.1399. I built an Integration Services package saved it closed up, came in the next day opened the project and I get 46 Warnings and the message on all of them is similar: