i want to stop and play server server 2000 using vb6.
for this i got one function on internet which is - Option Explicit
-
Public Enum ServiceState
-
et_Stop
-
et_Pause
-
et_Start
-
End Enum
-
-
-
-
Public Function ToggleSQLService(ServerName As String, _
-
State As ServiceState, UserID As String, _
-
Password As String) As Boolean
-
'*************************************
-
'PURPOSE: Start, Stop, or Pause SQL Server
-
'PARAMETERS: ServerName: Name of SQLServer
-
' State: Member of ServiceState Enum
-
' (see declarations)
-
' UserID: LoginID for SQL Server
-
' Password: Password for SQL Server
-
'
-
'RETURNS: True if successful, false otherwise
-
'REQUIRES: Reference to Microsoft SQLDMO object library
-
'EXAMPLE: ToggleSQLService "MyServer", et_Stop, -
-
' "sa", "myPassword"
-
'******************************************
-
Dim oSQLServer As New SQLDMO.SQLServer
-
If State < et_Stop Or State > et_Start Then Exit Function
-
On Error GoTo ErrorHandler
-
With oSQLServer
-
.Start False, ServerName, UserID, Password
-
Select Case State
-
Case et_Stop
-
.Stop
-
Case et_Pause
-
.Pause
-
Case et_Start
-
.Continue
-
End Select
-
End With
-
ToggleSQLService = True
-
ErrorHandler:
-
Set oSQLServer = Nothing
-
End Function
-
i write this function on my programe then on a clikevent of a button i write this to call a functio -
-
ToggleSQLService "MyServer", et_Stop, "sa", ""
-
-
i had a blank passwor then i run my project and click the button but
nothing happen my server is still running
so what wrong with it
2 1137 QVeen72 1,445
Recognized Expert Top Contributor
Hi,
Did you change "MyServer" to your actual Server name..?
and Instead of sa, Pass Win's "Administra tor" and Password..
REgards
Veena
yes i change my server name
regarding password
i did not assing any passwrod to my windows and
about sqlserver my username is "sa" and blank password
when i copy the code and click to call the function nothing happen and my server is still showing running just like that picture
Hi,
Did you change "MyServer" to your actual Server name..?
and Instead of sa, Pass Win's "Administra tor" and Password..
REgards
Veena
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Colin Steadman |
last post by:
I have created a function to kill all session variables
that aren't in a safe list. This is the function -
Sub PurgeSessionVariables
For Each Item In Session.Contents
Select Case Trim(Item)
Case "Authenticated"
Case "CI_CODE"
Case "organisation_description"
Case "location_description"
|
by: Chris Geerdink |
last post by:
combo with PHP. what is wrong with the Javascript?
else
{
include("mysql.php");
$query1 = mysql_query("INSERT INTO gbook (naam, email, text) VALUES
('".$_POST."', '".$_POST."', '".$_POST."')");
?>
<script language="JavaScript">
<!--
|
by: asdf |
last post by:
Hello!
Can someone tell me whats wrong with this piece of code:
Option Compare Database
Option Explicit
Sub retrieve()
Dim rst As ADODB.Recordset
Dim i As Integer
|
by: aa |
last post by:
When I am reading from local disk (d:), everithing is OK, but then I am
reading from map disk I am geting the this error. Whats wrong. Thanks
Server Error in '/Extra' Application.
----------------------------------------------------------------------------
----
The specified user does not exist.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more...
|
by: mahsa |
last post by:
Hi do you know whats wrong with this code?
<asp:HyperLink id="HLink_Help" runat="server" NavigateUrl='<%# "javascript:window.open('comments.aspx?id=1,width=500,height=600, scrollBars=yes');" %>'>Need Help?</asp:HyperLink>
--
mahsa
| |
by: blah |
last post by:
Hello everyone, Ive been trying to get my application to "click" on a
button in another application using SendMessage, Ive gotten this far
but Im not sure whats wrong with this code, here is the whole
application (its small for testing purposes) and it seems that window
wraps the text, at least when I preview this post:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
|
by: Mike Barnard |
last post by:
It's a simple test... VERY SIMPLE. But...
In an external stlyesheet some attributes don't show. With the same
styles cut and pasted to the test internally it works as expected.
Anyone tell me why? Its probably sooooooo obvious, but it is 1.19 am!
Thanks.
www.thunderin.co.uk/
|
by: Abubakar |
last post by:
Hi,
In my application, Some of my thread gets stuck somewhere. The vs2k5
debugging "Thread" window shows that stuck thread and I can I dentify it. In
its Name column the following text is written:
"std::_Container_base::_Orphan_all". What does this mean?
Now some general info about whats happnening here: :this is a call to a
SendMessage api, which I'm sending to my GUI window, and this call never
makes it back. I have checked the GUI...
|
by: islayer |
last post by:
can someone tell me what is wrong with the bold code? i am just learning perl. the program should create a perl file with a random name (5 letters, followed by a number), but the name is always just the number. whats wrong with my code?
#!/usr/bin/perl
use Fcntl;
@array = (a..z);
srand;
foreach (1..5)
{
$name = int(rand scalar(@array));
|
by: hiqu |
last post by:
This issue is driving me nuts and not able to figure out whats wrong.
I've this code in my firefox extension. Firefox always hangs and
reports the script is busy.
if I introduce a break statement in the for(;;) loop below, then
no issue.
Any help would be appreciated!
function getStuff()
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |