Problem connecting to sql server 2005 express database on local computer

I have a very basic console application whose sole purpose is to query a database on the same local computer. When i run the application, i get the error message below:

Cannot open user default database. Login failed.
Login failed for user 'someDomain\SomeUserName'.

Below is my connection string also

myconnection_string = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Reporting System\App_Data\safetydata.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True").

 After some googling, some post pointed to deleting a user folder at :

C:\Documents and Settings\myusername\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

 but still deleting that folder and restarting the machine doesn't help and i also have remote connections enabled. Help is really needed.

 NOTE: The same application runs on a different computer with XP but fails on the Pc with windows server 2003.

 


 


--------------------------------------------------
No Project Too Eazy.
--------------------------------------------------
0
Nick
3/18/2008 12:21:58 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

3 Replies
498 Views

Similar Articles

[PageSpeed] 58

Assuming you place your database file in the App_Data folder, modify your conection string as :-

myconnection_string = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|safetydata.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True").

--------------------------------------------------------------------------------------------------------------------------------------

Please mark as Answer if this helped in solving your problem.


Please click "Mark As Answer" if this hepled in solving your problem.
0
sudipta
3/18/2008 12:57:49 PM

sudipta:

Assuming you place your database file in the App_Data folder, modify your conection string as :-

myconnection_string = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|safetydata.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True").

The database can not be moved from its current location, which is an App_Data folder of a an asp.net website database application. So moving the database into the console application data directory is not option because that would mean changing the asp.net application connectionstring. I want to access that database in the asp.net webite App_Data folder from a console application. The asp.net website and the console application are both on the same computer.

 


--------------------------------------------------
No Project Too Eazy.
--------------------------------------------------
0
Nick
3/18/2008 1:16:16 PM

Hi Nick,

The error message you are getting now indicates that you have successfully connected to the database, however,  you cannot open/access to that database for some reasons. Besides, since you have mentioned in your post that it works fine on other's machine, I would think it maybe a permission issue.

Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Reporting System\App_Data\safetydata.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True

Note in your connection string, you have specified Interagrated Security as the authentication type which means that ado.net would use windows authentication to login to sql server. Make sure the windows account which your application is running under has been included in sqlserver permission list and if not, try to add it or use sql server authentictaion instead.

Hope my suggestion helps


Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
0
Bo
3/21/2008 8:44:11 AM
Reply:

Similar Artilces:

Migrating sql server 2005 express database to sql server 2005 database
Hi, I have an application developed using VWD and sqlserver express database. The express database is turning out to be small in size and we need to migrate to larger sqlserver 2005 database. What are the steps for this migration, please list in detail. Regards, Sandyhttp://www.thequinn.infohttp://www.sksdataservices.comhttp://www.infobasket.info Hi Sandy, To move a database from SQL Express to SQL 2005, you can use the following steps. 1. If your database file is attached to the server instance, you will need to detach it first using SQL management studio. If it is under App_Data folde...

SQL Server 2005 Installation problems with SQL Server Express & SQL Server 2000
Hi Guys, I have had SQL Server Express and Sql Server Management Studio Express installed on my machine for some time and recently tried to install a trial of SQL Server 2005 as well.  (Yes, I'm migrating from Visual Studio Express to Visual Studio Professional, just as in tended!) Everything went fine except that nothing seemed to be installed.  I searched in all the obvious places - both on the Start/Programs menu and on the hard-drive: nothing. A check under Add/Remove Programs showed that Sql Server 2005 Express was installed, but called SQL Server 2005. So after a number o...

How to connect to Remote SQL Server database using SQL Server 2005 Express
Hi,I've an account with a hosting service provider online for SQL Server database. I've downloaded SQL Server 2005 Express from ASP.Net. How can I use it to connect to my SQL Server Database which is sitting on remote server? The hosting provider gave me following things to connect to the remote database.Server NameDatabase NameUser NamePasswordRegards,A.K.R    Anyone? I don't want to ask the obvious, but is there not a Read Me file included with the download of SQL Express which would explain how to connect? Sorry I can't be more helpful, but I've only ever briefly ...

Problem with creating new SQL server database in VWDExpress using SQL Server 2005 Express
 when I try to create a SQL Database from Visual Web Developer 2005 Express Edition, I get the following error message: "Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly.  Please verify the installation of the component or download from the URL http://go.microsoft.com/fwlink/?LinkID=49251" When I go to that URL, it brings me to the page to download SQL Server Express 2005. any ideathanks for advance  Did you install SQL Server Express on your server/system? JeffPlease: Don't forget to click "Mark as Answe...

Moving SQL Server 2005 Database to SQL Server 2005 Express
Hi, I have SQL Server 2005 in my Development machine but the hosting server has only SQL server 2005 Express. I was wondering if I develop the DB in SQL server 2005 would be able to move/deploy it to SQL Server Express in the production server? If so how? Can I just generate the script and then run it on the productions server? Or there is a better/easier way? Thanks in advanceShuaib----------------------- I don't anticipate any problems creating database in SQL Server 2005 and moving it to Express. If you need to generate the script to create an empty shell (no d...

If I upgrade sql server 2005 express to sql server 2008 express, will my user instances in the 2005 database be transfered automaticly?
If I upgrade sql server 2005 express to sql server 2008 express, will my user instances in the 2005 database be transfered automaticly? Thanks! Hi asdpai, I am not sure if I catch your meaning.But if you want to upgrade the SQL Server 2005 Express to SQL Server 2008 Express, you may refer to the following link: Version and Edition Upgradeshttp://msdn.microsoft.com/en-us/library/ms143393.aspxHow to: Upgrade to SQL Server 2008 (Setup)http://msdn.microsoft.com/en-us/library/ms144267.aspxJian KangMicrosoft Online Community SupportPlease remember to mark the replies as answers if t...

Restoring a SQL Server Express 2005 Database to SQL Server Standard 2005
Hello,If I backup and restore an express database to sql server 2005 standard, will there still be limitations in regards to the database size, cpu...etc.? Thanks,Jon  I suppose that no. Limitations are connected to SQL engine not to database itself. But probably if your database will grow up connected to SQL Standard and you will try to move it back to SQL express you will be in trouble.  ThanksJPazgier...

Converting MDF files (SQL Server Express) to SQL Server 2005 WITHOUT having to buy SQL Server 2005 (I have Express). Personal WebSite Starter Kit
Hi (and HELP!),   I downloaded the Personal WebSite Starter Kit and got it working no problem on my local machine.  But I've had nothing but frustration trying to get it up and running on a webhosting site.  I picked hostmysite.com which uses SQL Server 2005.  I was under the impression that it wouldn't be that big a deal to convert the .MDF files that Sql Server Express uses to a SQL Server 2005 database.  I tried using SQL Server Management Studio Express.  I was able to "see" my remote database on hostmysite.com, but I was not able to import the .mdf files ...

Converting MDF files (SQL Server Express) to SQL Server 2005 WITHOUT having to buy SQL Server 2005 (I have Express). Personal WebSite Starter Kit
Hi (and HELP!),   I downloaded the Personal WebSite Starter Kit and got it working no problem on my local machine.  But I've had nothing but frustration trying to get it up and running on a webhosting site.  I picked hostmysite.com which uses SQL Server 2005.  I was under the impression that it wouldn't be that big a deal to convert the .MDF files that Sql Server Express uses to a SQL Server 2005 database.  I tried using SQL Server Management Studio Express.  I was able to "see" my remote database on hostmysite.com, but I was not able to import the .mdf file...

Converting MDF files (SQL Server Express) to SQL Server 2005 WITHOUT having to buy SQL Server 2005 (I have Express). Personal WebSite Starter Kit
Hi,Basically i built a webpage with Login and it's working well from my local machine.Right now, i'm using Database Publishing Wizard. the problem is how do i convert.MDF files to .SQL 2005 to get my database publish in the internet? thanks  Place your .MDF file in the App_Data directory, change the connection string accordingly and then publish your web site. ----------------------------------------------------------Please click Mark As Answer if this helped in solving your problem.  Please click "Mark As Answer" if this hepled in solving your problem. ...

SQL Express
Hi,I have SQL Server Express Edition. I tried working out some ASP.NET Labs in my local system. Here is the link of the Virtual Lab which I tried. http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032286906&EventCategory=3&culture=en-US&CountryCode=USI recieve this error in my local system. 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: Named Pipes Provider, error: 40 - Cou...

Visual Web Dev Express 2008 and SQL server Express 2005 database connection problem
Apologies if this has already been covered, i can't find any search function on the forum. I have a somewhat annoying problem with the above software. I use Vista Home Premium x64 and have decided to install VWD 2008 and SQL2005 to learn ASP and SQL development. I only have a moderate undertanding of standard HTML and would like to expand my knowledge.  It is the final non-beta version of VWD 2008. The install went fine and no errors were shown. After trying to connect to the database via the ASP.NET application tool in VWD it gives an "unable to connect to the database ...

How to convert a SQL Server 2005 Database to SQL Server Express
Hi, I have a SQL Server 2005 Database that I would like to export to SQL Server Express. How do I go about this? I've tried backing it up, creating a new (blank) SQL Server Express Database and trying to restore it, but get the following message: TITLE: Microsoft SQL Server Management Studio------------------------------ Restore failed for Server 'PRODSOL-LAPTOP1\SQLEXPRESS'.  (Microsoft.SqlServer.Smo) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOp...

Local SQL 2005 Express to Hoster SQL 2005 Server
I have been creating applications using SQL Express and uploading them to my hoster. No problems there. Now, I feel I'm ready to the next step and would like to start using my hoster SQL Server. I have created a database in their server, now how do I move my created SQL Express Database to their regular SQL Server? Is there a way to run a tool against my local DB and create a script to run in my hoster? What is the best practise here? Your help is appreciated. Download the Database Publishing Wizard from Microsoft - it's a free tool that integrates with your IDE (Visual Studio or ...

Web resources about - Problem connecting to sql server 2005 express database on local computer - asp.net.sql-datasource

List of Nebraska Connecting Link, Spur, and Recreation Highways - Wikipedia, the free encyclopedia
Nebraska Connecting Link , Nebraska Spur , and Nebraska Recreation Road highways are a secondary part of the Nebraska highway system . They connect ...

Israeli Hotel U Coral Beach Club Eilat Has a Unique Way of Connecting Guests to Facebook
U Coral Beach Club Eilat, a hotel in Israel , is taking sharing vacation photos and checking in to the next level thanks to a collaboration between ...

Digital Media Wire - connecting people & knowledge —
dmwnews : Anomaly, the ambitious graphic novel by Brittenham and Haberlin, features augmented reality. http://bit.ly/Iwrxjr Already optioned ...

Connecting 100 Million People in Africa
„Facebook for Business“ liefert dir aktuelle Nachrichten, Tipps und Best Practices für den Einsatz von Facebook zur Erreichung deiner Unternehmensziele: ...

What stops users from connecting with an app through Facebook?
... This equals 850 million users who connect with apps using Facebook at a 59 percent conversion rate. About 590 million users back out of connecting ...

Home - WHLT 22 Connecting the Pine Belt Fan
Facebook is a social utility that connects people with friends and others who work, study and live around them. People use Facebook to keep up ...

US IT Staffing Recruiters Group - Connecting Ideas !
US IT Recruiter's Groups: IT Technical Recruitment. Its all about connecting to new Ideas !

Jewel Dots Puzzler - A Cool Connecting Dots Puzzle For Kids on the App Store on iTunes
Get Jewel Dots Puzzler - A Cool Connecting Dots Puzzle For Kids on the App Store. See screenshots and ratings, and read customer reviews.

Connecting the community, my Twitter strategy, and American Airlines at DFW - Flickr - Photo Sharing ...
I thought, to commemorate this entry on connecting people, that I'd include a photo of an airplane from one of the busiest airports in the world ...

Connecting to Community Graduation YouTube 1080p - YouTube
(Sioux Falls, S.D.) Forty-six seniors have graduated from trying to find the power button to now being avid e-mail, Facebook, Pinterest and Tumblr ...

Resources last updated: 11/29/2015 1:17:03 AM