Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Sql connection error

Posted on 2010-08-24
19
Medium Priority
?
241 Views
Last Modified: 2012-05-10
I have VS2008 windows app that I have been working on for months and all of sudden by connection to my .mdf file is in error.  

If anyone has any insight, please help, because I am at a total lost as to how this is occurring.

Thanks,
My connection string is:
"Data Source=.\SQLEXPRESS;AttachDbFilename='c:\documents and settings\jaydee\my documents\visual studio 2005\projects\statpro\statpro\Database1.mdf';Integrated Security=True;User Instance=True"

The specific error that I am receiving is:

System.Data.SqlClient.SqlException was unhandled
  Class=11
  ErrorCode=-2146232060
  LineNumber=65536
  Message="Cannot open user default database. Login failed. Login failed for user 'JD\JayDee'."
  Number=4064
  Procedure=""
  Server="\\.\pipe\9CC84DFF-2F00-40\tsql\query"
  Source=".Net SqlClient Data Provider"
  State=1
  StackTrace:
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
       at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
       at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
       at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
       at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.SqlClient.SqlConnection.Open()
       at StatPro.MAIN.MAIN_Load(Object sender, EventArgs e) in C:\Documents and Settings\JayDee\My Documents\Visual Studio 2005\Projects\StatPro\StatPro\MAIN.vb:line 22
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, Int32 wParam, Int32 lParam)
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.set_Visible(Boolean value)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at StatPro.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
       at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
       at System.Activator.CreateInstance(ActivationContext activationContext)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:
0
Comment
Question by:nationaltravel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 6
19 Comments
 
LVL 3

Expert Comment

by:59cal
ID: 33510225
has the SQL login been disabled?
0
 
LVL 3

Expert Comment

by:59cal
ID: 33510235
or even locked out?
0
 

Author Comment

by:nationaltravel
ID: 33510270
@59Cal

Not to my knowlegdge.  How can I check either of these?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Expert Comment

by:59cal
ID: 33510300
Open up SQL management studio and try and connect to the SQL instance. If this connects, then the account is not logged out
0
 

Author Comment

by:nationaltravel
ID: 33510373
Is there another method as I do not have SQL managment studio?
0
 
LVL 3

Expert Comment

by:59cal
ID: 33510398
not that i know of. you can download SQL Management studio express. Its a free download from MS
0
 

Author Comment

by:nationaltravel
ID: 33510424
Thanks.  I am doing so now.
0
 

Author Comment

by:nationaltravel
ID: 33510524
I have downloaded the studio and now i am receiving the following error message:

TITLE: Connect to Server
------------------------------

Cannot connect to JD\MSSMLBIZ.

------------------------------
ADDITIONAL INFORMATION:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Shared Memory Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------
0
 

Author Comment

by:nationaltravel
ID: 33510550
I was able to correct that error, but i am not able to navigate to my .mdf file.
0
 
LVL 3

Expert Comment

by:59cal
ID: 33510604
is the database listed in Management studio?
0
 

Author Comment

by:nationaltravel
ID: 33510624
No, it is not.
0
 

Author Comment

by:nationaltravel
ID: 33510649
Also, i am receiving this error message in the Studio.

Can not create a stable subkey under a volatile parent key.
0
 
LVL 7

Expert Comment

by:Alex_W
ID: 33510687
You mean when you navigate in SQL management studio to ...\Database1.mdf it doesnt exist in your program folder?  What about in Explorer?
0
 

Author Comment

by:nationaltravel
ID: 33510700
Correct, I can not navigate to the .mdf in the Studio.

Yes, I can locate the .mdf in my Explorer.
0
 
LVL 3

Expert Comment

by:59cal
ID: 33510776
can you attach your mdf file to the SQL instance?
0
 

Author Comment

by:nationaltravel
ID: 33510894
No, the studio will not allow me to navigate down to it.
0
 

Author Comment

by:nationaltravel
ID: 33511078
@59cal

No, the studio will not allow me to navigate down into subfolders to attach the .mdf.
0
 

Accepted Solution

by:
nationaltravel earned 0 total points
ID: 35484093
The only solution that I could find to resolve this was to recereate the db.
0
 

Author Closing Comment

by:nationaltravel
ID: 35510797
I was not finding any anwers and my deadline for completion was approaching quickly, so this was my quickest solution
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question