473,385 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Starting SQL Server 2012 services in Visual Basic 2013

28
I am using SQL Server 2012 Developer edition and Visual Studio 2013

Expand|Select|Wrap|Line Numbers
  1. Imports System.ServiceProcess (also included in project.references)
  2.  
  3. Dim service As New ServiceController("MSSQLSERVER") ' For checking status of SQL Server & starting if necessary
  4.  
  5. If service.Status = ServiceControllerStatus.Stopped Or service.Status = ServiceControllerStatus.Paused Then
  6.         Try
  7.             service.Start()
  8.         Catch ex As Exception
  9.             MsgBox("StartService error: " & ex.Message)
  10.         End Try 
  11. End If
  12.  
  13.  
I get the error message that the application can't start the service on my computer.

I've also tried running a .bat file containing NET START Servicename as a shell; it runs but doesn't start the services

My MSSQLSERVER and SQL Server Agent services are set to start Automatically, but they don't alsway start, which is why I want to test their status, and then start them if necessary.

Has anyone any ideas how to resolve this problem
Feb 7 '16 #1
1 1256
MickT
28
I hope that's all right now.
Feb 9 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dehniz | last post by:
I want know how I can create aplications in Visual basic that run like service in any Windows. Thanks Dehniz
5
by: Microsoft | last post by:
Hi, I have Visual Basic .net 2003 (Standard Edition) & SQL Server 2000 Developer Edition. When trying to create a connection in the server explorer from the .net IDE I get a number of problems;...
1
by: nuoo | last post by:
Programming Microsoft SQL Server 2000 with Microsoft Visual Basic .NET Learn how to turn data into solutions with SQL Server 2000, Visual Basic .NET, and XML. Get a fundamental grasp of SQL...
3
by: iansinke | last post by:
Hi, I have Visual C# 2005 Express Edition and SQL Server 2005 Express Edition. I downloaded and installed the Advanced Services for SQL Server 05, and the Toolkit for SQL Server 05. I installed...
97
by: Master Programmer | last post by:
An friend insider told me that VB is to be killled off within 18 months. I guess this makes sence now that C# is here. I believe it and am actualy surprised they ever even included it in VS 2003 in...
4
by: raaman rai | last post by:
guys, what is the idea to backup sql server databse via visual basic code. And i also want the code please.
0
by: TG | last post by:
hi! I am trying to import a text file into a table created on the fly in SQL Server 2005 since the number of columns can vary depending on what the user has checked or not. Here is the code I...
0
by: kostakostvb | last post by:
Hello, I am creating a file downloader in Visual Basic 2012. It works well, but when I click the red X button, it closes whether the download has finished or not. Thus, I am looking for code that...
2
9815402440
by: 9815402440 | last post by:
Hi folks, can you please explain what (Of T) is after function name in following line: Public Function StdDev(Of T)( source As IEnumerable(Of T), selector As Func(Of T, Decimal)) As Decimal ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.