Solved

Sql connection error

Posted on 2010-08-24
19
224 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
  • 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

839 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