Solved

Sql connection error

Posted on 2010-08-24
19
214 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
Comment Utility
has the SQL login been disabled?
0
 
LVL 3

Expert Comment

by:59cal
Comment Utility
or even locked out?
0
 

Author Comment

by:nationaltravel
Comment Utility
@59Cal

Not to my knowlegdge.  How can I check either of these?
0
 
LVL 3

Expert Comment

by:59cal
Comment Utility
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
Comment Utility
Is there another method as I do not have SQL managment studio?
0
 
LVL 3

Expert Comment

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

Author Comment

by:nationaltravel
Comment Utility
Thanks.  I am doing so now.
0
 

Author Comment

by:nationaltravel
Comment Utility
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
Comment Utility
I was able to correct that error, but i am not able to navigate to my .mdf file.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 3

Expert Comment

by:59cal
Comment Utility
is the database listed in Management studio?
0
 

Author Comment

by:nationaltravel
Comment Utility
No, it is not.
0
 

Author Comment

by:nationaltravel
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
can you attach your mdf file to the SQL instance?
0
 

Author Comment

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

Author Comment

by:nationaltravel
Comment Utility
@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
Comment Utility
The only solution that I could find to resolve this was to recereate the db.
0
 

Author Closing Comment

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

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now