Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 All SQL server Express not functioning C#

Author  Topic 

AaronH
Starting Member

6 Posts

Posted - 2013-11-19 : 07:31:30
I have an application in C# that I made in Visual Studio 2013 which contains two SQL server Express (2012) databases (.mdf), which I use the auto generated linked textBoxes from in my app for users to input information which can be stored.

Everything has been functioning perfectly until yesterday when suddenly I started getting the following error message when I degubbed in visual studio, and also when I ran an earlier published version, therefore suggesting it is not an issue with the program/code, but the SQL server itself.

"sqlservr.exe - Application Error" - The application was unable to start correctly (0xc0000142).

I have tried un-installing and re-installing SQL Server Express 2012, however this did not fix the issue. I am still new to programming and so any help would be much appreciated. Thank you.

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-11-19 : 08:23:48
See if you can start SQL Server from the services window. (Start -> Run -> services.msc, and look for the service named YourComputerName\SQLExpress). If you are unable to start it, see the username that it is trying to start under (in the logon tab) and see if that is the problem. If you are running using your login, and if you have changed your password, for example, this can happen.
Go to Top of Page

AaronH
Starting Member

6 Posts

Posted - 2013-11-19 : 09:41:35
Thanks for your reply. I tried this but could not find any items on the list with MyComputerName/SQLExpress. The only similar one is called, SQL server (SQLEXPRESS).
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-11-19 : 10:11:52
quote:
Originally posted by AaronH

Thanks for your reply. I tried this but could not find any items on the list with MyComputerName/SQLExpress. The only similar one is called, SQL server (SQLEXPRESS).

You are right - my mistake. It is called SQL Server (SQLEXPRESS). Is that service running?
Go to Top of Page

AaronH
Starting Member

6 Posts

Posted - 2013-11-19 : 10:19:11
Yes it appears to be running. I even attempted to create a blank project in Visual Studio and add a brand new .mdf file, but I still get the same error.
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-11-19 : 10:43:12
I don't know what to suggest, especially so because everything that you are doing was working as you expect upto some point in time. When you run it using Visual Studio debugger, what is the line in the code that throws the error? That might give some clue. When you said you add a brand new mdf file, are you adding it in code, or are you adding it via the Server Explorer?
Go to Top of Page

AaronH
Starting Member

6 Posts

Posted - 2013-11-19 : 10:49:47
I am not creating it from code. I created a new windows form project in C#, and then right clicked on the project in the explorer view on the right, then add, new Service Based Database (.mdf) file. Visual studio then pauses for a moment before showing me the error message.
Go to Top of Page

AaronH
Starting Member

6 Posts

Posted - 2013-11-19 : 11:37:00
This is the line of code it hightlights with the error, presumably because it is trying to fill the table with data that it cannot find/access.

public virtual int Fill(SuspensiondatabaseDataSet.TableDataTable dataTable) {
this.Adapter.SelectCommand = this.CommandCollection[0];
if ((this.ClearBeforeFill == true)) {
dataTable.Clear();
}

//****THE FOLLOWING LINE IS THE HIGHTLIGHTED ERROR****
int returnValue = this.Adapter.Fill(dataTable);

return returnValue;
}

Thanks again for your time.
Go to Top of Page
   

- Advertisement -