Hello,
I'm using MS Visual C# 2005 Express, but I can't create a new local database file in the "Add -> New Item" dialog. The Studio doesn't create the database, but shows a file not found message.
Any ideas?
Can you connect to SQL Server Express and create the database manually? If yes, then the issue is within Visual C# and you should post this issue on a Visual C# Express forum. If you encounter an error with manually creating the database, let us know what that error is.
Thanks
Laurentiu
I can connect to the server with the SQL Server Management Studio und create new databases. But Visual C# could't even connect to any existing database. If I click on "Test connection" in add data source dialog the following message shows up:
"Unable to open physical file <path>. Operating System error 32 (Error not found) An attempt to attach a auto-named database failed. A database with the same name exists or the specified file cannot be opened or it's located on an UNC share."
I haven't much experience with the SQL Server, therefore I have now idea what this error means. In fact there is no database with the same name and don't know why it couldn't access the file. Unfortunately I've never heard anything about UNC shares before.
Are there some important steps I have to consider before I create a database manually?
Thanks.
Let's take these as two different problems; connecting to an existing database and creating a database. It's easy to start mixing up the behaivors and confuse the issue.
Creating a DB in VS
Could you describe the exact steps you're using in VS to create a new database? What is the exact error message you're getting? Does your effort result in a database file being created and where does the file end up?
Connecting to an existing DB in VS
Again, what are the exact steps you're using to connect to the database? Is the database already attached to SQL Express? Where is the database file located?
Thanks for the additional detail.
Regards,
Mike Wachal
SQL Express team
-
Please mark your thread as Answered when you get your solution.
Create a DB in VS
When I tried to create a new DB in VS I followed this steps: First of all I loaded my solution then made a right click on my project in the solution explorer and selected "Add Item -> New Item" in the context menu. Finally I selected the SQL DB in the "Add New Item" dialog in order to add a local database file to my project. But it still doesn't work although I have tried it with various file names. VS shows up a short error message ("The system cannot find the specified file.") with the title "Local database file" I cannot find a database file too.
Is it necessary to make any further inititialisations before I can use SQL files in VS? I've already done a lot with VS but I never used SQL before. Because of that I didn't configure anything but the process or service is running in the background.
Connecting to an existing DB in VS
In order to isolate the problem I created a new DB with the MS SQL Server Management Studio Express and tried to connect in VS to the new database considering the following steps: I clicked on "Add New Data Source" in the Data Source Frame in VS. Then I selected a database in the dialog and the file of the database I had created with the Management Studio before. If I detached the DB the VS test connection succeeds but if I click on "OK" VS shows again the same error as if I created the DB directly in VS. ("The system cannot find the specified file.") If I didn't detach the DB, VS failed to establish a test connection because the file is already in use. I moved the database file in different directories but nothing changed.
In the end it seems to me that VS can neither create a database nor connect to a existing one.
Thanks for your support.
Bj?rn
|||Hi Bjorn,
Create DB in VS
I'll see if any of the VS folks have an idea on this one. What you describe should work.
Connecting to Existing DB in VS
The error you're getting here is expected. In this case, VS is actually creating a connection string that starts a new instance of SQL Express (called a User Instance) and attaches the database to that new instance. Since you can only have a database attached to a single instance of SQL, you get an error. As you've noticed, this problem doesn't happen when you've detached the database from the main instance.
Regards,
Mike Wachal
SQL Express team
-
Check out my tips for getting your answer faster and how to ask a good question: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=307712&SiteID=1
A couple of things. First, it sounds like SQL Server Express (SSE) is not installed on your machine. SSE allows you to make file-based connections to a database without a logical database name (as is the default behavior for the "local" database story in VS.
Secondly, if you are using VC#, VB, or VC Express, you cannot even connect to an up-level version of SQL Server. You can only connect to SSE (the free version of SQL Server). And, in particular, you can *only* make a local database style connection via the tools.
For the version of SQL Server that is running, see if the instance name is "SQLExpress". If it is not, that is the most likely problem. You can download it from the web for free.
Lance
This posting is provided "AS IS" and confers no rights and provides no warranties.
|||First of all thanks for your support and you are right. It seems I have a SQL Server 2005 version on my system instead of SQL 2005 Express. Therefore I downloaded the SQL Express Version (with Advanced Services) from Microsoft.com but it turns out that I've got another problem. Since I already had an Running SQL Server on my machine (named "Microsoft SQL Server 2005" in control panel->software and running 2 background processes SQLServ and SQLwriter), I followed the download notice and tried to remove the old version. Unfortunately the wizards halts with this meaningful error:
"TITLE: Microsoft SQL Server 2005 Setup. MESSAGE: There was an unexpected failure during the setup wizard. You may review the setup logs and/or click the help button for more information."
The message comes up whether I stop all SQL processes in the SQL Configuration Manager or not. Furthermore the help button and the related help page don't provide any additional information.
Hence I tried out the other way outlined by the installation instructions. I removed all files from the "\MSSQL.1\MSSQL\Template Data\" directory and ran the installation routine of SQL 2005 Express afterwards, but surprisingly the new wizards halts with the same error already mentioned above.
It's maybe useful to consider that I didn't install the old version explicitly. I guess it comes bundled with Visual C# 2005 Express.
bj?rn
|||Hi Bjorn,
There seems to be some confusion about whether you actually have SQL Express or not. You've said you don't, but the Template Data directory should even exist unless you actually have SQL Express installed. We need to clear up what you've installed and what you haven't. All versions of VS Express give you the option to install SQL Express.
To determine what you have installed, could you open up SQL Configuration Manager and let me know how many instances of SQL you have listed and what each of them is named?
Also, there should be more information in the setup error logs about the failure you're experiencing. Could you take a look at those logs and let me know what they say?
Thanks for the additional information.
Regards,
Mike Wachal
SQL Express team
-
Check out my tips for getting your answer faster and how to ask a good question: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=307712&SiteID=1
Hello,
There are two instances listed in the SQL Configuration Manager. The first is labeled "SQL Server (SQLExpress)" and is running. The second one is "SQL Server Browser", it's stopped and I can't start it (the run button is disabled).
I found the following setup log:
Microsoft SQL Server 2005 Setup beginning at Wed Apr 26 13:59:32 2006
Process ID : 4028
D:\Programme\Microsoft SQL Server\90\Setup Bootstrap\setup.exe Version: 2005.90.1399.0
Running: LoadResourcesAction at: 2006/3/26 13:59:32
Complete: LoadResourcesAction at: 2006/3/26 13:59:32, returned true
Running: ParseBootstrapOptionsAction at: 2006/3/26 13:59:32
Loaded DLL:D:\Programme\Microsoft SQL Server\90\Setup Bootstrap\xmlrw.dll Version:2.0.3604.0
Complete: ParseBootstrapOptionsAction at: 2006/3/26 13:59:32, returned false
Error: Action "ParseBootstrapOptionsAction" failed during execution. Error information reported during run:
Could not parse command line due to datastore exception.
Source File Name: utillib\persisthelpers.cpp
Compiler Timestamp: Fri Jul 29 01:13:55 2005
Function Name: writeEncryptedString
Source Line Number: 124
-
writeEncryptedString() failed
Source File Name: utillib\persisthelpers.cpp
Compiler Timestamp: Fri Jul 29 01:13:55 2005
Function Name: writeEncryptedString
Source Line Number: 123
-
Error Code: 0x80070002 (2)
Windows Error Text: Das System kann die angegebene Datei nicht finden.Source File Name: cryptohelper\cryptsameusersamemachine.cpp
Compiler Timestamp: Mon Jun 13 14:30:00 2005
Function Name: sqls::CryptSameUserSameMachine::ProtectData
Source Line Number: 502
Running: ValidateWinNTAction at: 2006/3/26 13:59:32
Complete: ValidateWinNTAction at: 2006/3/26 13:59:32, returned true
Running: ValidateMinOSAction at: 2006/3/26 13:59:32
Complete: ValidateMinOSAction at: 2006/3/26 13:59:32, returned true
Running: PerformSCCAction at: 2006/3/26 13:59:32
Complete: PerformSCCAction at: 2006/3/26 13:59:32, returned true
Running: ActivateLoggingAction at: 2006/3/26 13:59:32
Error: Action "ActivateLoggingAction" threw an exception during execution. Error information reported during run:
Datastore exception while trying to write logging properties.
Source File Name: datastore\cachedpropertycollection.cpp
Compiler Timestamp: Fri Jul 29 01:13:49 2005
Function Name: CachedPropertyCollection::findProperty
Source Line Number: 130
-
Failed to find property "primaryLogFiles" {"SetupStateScope", "", ""} in cache
Source File Name: datastore\propertycollection.cpp
Compiler Timestamp: Fri Jul 29 01:13:50 2005
Function Name: SetupStateScope.primaryLogFiles
Source Line Number: 44
-
No collector registered for scope: "SetupStateScope"
00D7CFC4Unable to proceed with setup, there was a command line parsing error. : 2
Error Code: 0x80070002 (2)
Windows Error Text: Das System kann die angegebene Datei nicht finden.Source File Name: utillib\persisthelpers.cpp
Compiler Timestamp: Fri Jul 29 01:13:55 2005
Function Name: writeEncryptedString
Source Line Number: 123Failed to create CAB file due to datastore exception
Source File Name: datastore\cachedpropertycollection.cpp
Compiler Timestamp: Fri Jul 29 01:13:49 2005
Function Name: CachedPropertyCollection::findProperty
Source Line Number: 130
-
Failed to find property "HostSetup" {"SetupBootstrapOptionsScope", "", "4028"} in cache
Source File Name: datastore\propertycollection.cpp
Compiler Timestamp: Fri Jul 29 01:13:50 2005
Function Name: SetupBootstrapOptionsScope.HostSetup
Source Line Number: 44
-
No collector registered for scope: "SetupBootstrapOptionsScope"
Message pump returning: 2
I installed it with VS C# Express and the version is Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86).
Bj?rn
|||Hi Bjorn,
At this point I'm not sure what's up with your server. From your first message there was something wrong with your copy of C# creating database, but SQL Express seemed find based on the fact that it worked with Management Studio.
If I were you, I'd try to uninstall SQL Express to get it completely off your system and then do a clean installation of either SQL Express or SQL Express with Advanced Services, which ever one you want. I'd try to get back to the state where SQL is working, then if there is still a problem with C#, we can push this thread to one of the VS groups to see if they have any ideas how to fix the VS problem.
Mike
|||Hello,
I already tried to remove SQL Server from my system, but unfortunately there's the same problem. So I can't even uninstall it.
Errorlog:
Microsoft SQL Server 2005 Setup beginning at Wed May 03 13:16:44 2006
Process ID : 2348
D:\Programme\Microsoft SQL Server\90\Setup Bootstrap\setup.exe Version: 2005.90.1399.0
Running: LoadResourcesAction at: 2006/4/3 13:16:44
Complete: LoadResourcesAction at: 2006/4/3 13:16:44, returned true
Running: ParseBootstrapOptionsAction at: 2006/4/3 13:16:44
Loaded DLL:D:\Programme\Microsoft SQL Server\90\Setup Bootstrap\xmlrw.dll Version:2.0.3604.0
Complete: ParseBootstrapOptionsAction at: 2006/4/3 13:16:44, returned false
Error: Action "ParseBootstrapOptionsAction" failed during execution. Error information reported during run:
Could not parse command line due to datastore exception.
Source File Name: utillib\persisthelpers.cpp
Compiler Timestamp: Fri Jul 29 01:13:55 2005
Function Name: writeEncryptedString
Source Line Number: 124
-
writeEncryptedString() failed
Source File Name: utillib\persisthelpers.cpp
Compiler Timestamp: Fri Jul 29 01:13:55 2005
Function Name: writeEncryptedString
Source Line Number: 123
-
Error Code: 0x80070002 (2)
Windows Error Text: Das System kann die angegebene Datei nicht finden.Source File Name: cryptohelper\cryptsameusersamemachine.cpp
Compiler Timestamp: Mon Jun 13 14:30:00 2005
Function Name: sqls::CryptSameUserSameMachine::ProtectData
Source Line Number: 502
Running: ValidateWinNTAction at: 2006/4/3 13:16:44
Complete: ValidateWinNTAction at: 2006/4/3 13:16:44, returned true
Running: ValidateMinOSAction at: 2006/4/3 13:16:44
Complete: ValidateMinOSAction at: 2006/4/3 13:16:44, returned true
Running: PerformSCCAction at: 2006/4/3 13:16:44
Complete: PerformSCCAction at: 2006/4/3 13:16:44, returned true
Running: ActivateLoggingAction at: 2006/4/3 13:16:44
Error: Action "ActivateLoggingAction" threw an exception during execution. Error information reported during run:
Datastore exception while trying to write logging properties.
Source File Name: datastore\cachedpropertycollection.cpp
Compiler Timestamp: Fri Jul 29 01:13:49 2005
Function Name: CachedPropertyCollection::findProperty
Source Line Number: 130
-
Failed to find property "primaryLogFiles" {"SetupStateScope", "", ""} in cache
Source File Name: datastore\propertycollection.cpp
Compiler Timestamp: Fri Jul 29 01:13:50 2005
Function Name: SetupStateScope.primaryLogFiles
Source Line Number: 44
-
No collector registered for scope: "SetupStateScope"
00D7CFC4Unable to proceed with setup, there was a command line parsing error. : 2
Error Code: 0x80070002 (2)
Windows Error Text: Das System kann die angegebene Datei nicht finden.Source File Name: utillib\persisthelpers.cpp
Compiler Timestamp: Fri Jul 29 01:13:55 2005
Function Name: writeEncryptedString
Source Line Number: 123Failed to create CAB file due to datastore exception
Source File Name: datastore\cachedpropertycollection.cpp
Compiler Timestamp: Fri Jul 29 01:13:49 2005
Function Name: CachedPropertyCollection::findProperty
Source Line Number: 130
-
Failed to find property "HostSetup" {"SetupBootstrapOptionsScope", "", "2348"} in cache
Source File Name: datastore\propertycollection.cpp
Compiler Timestamp: Fri Jul 29 01:13:50 2005
Function Name: SetupBootstrapOptionsScope.HostSetup
Source Line Number: 44
-
No collector registered for scope: "SetupBootstrapOptionsScope"
Message pump returning: 2
Is it possible that my windows installation is corrupt? But I haven't any other problems except that my system is quite slow.
Bj?rn
|||Hi Bjorn,
It looks like something failed to uninstall correctly. You can find some suggestions on how to clean up your systems at the following link :
http://blogs/jdbaker/archive/2006/04/20/10684.aspx
I hope that helps
Michelle
No comments:
Post a Comment