473,804 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

whats wrong with this code

284 Contributor
i want to stop and play server server 2000 using vb6.
for this i got one function on internet which is
Expand|Select|Wrap|Line Numbers
  1.  Option Explicit 
  2. Public Enum ServiceState
  3.     et_Stop
  4.     et_Pause
  5.     et_Start
  6. End Enum
  7.  
  8.  
Expand|Select|Wrap|Line Numbers
  1.  
  2. Public Function ToggleSQLService(ServerName As String, _
  3.     State As ServiceState, UserID As String, _
  4.     Password As String) As Boolean
  5. '*************************************
  6. 'PURPOSE:     Start, Stop, or Pause SQL Server
  7. 'PARAMETERS:    ServerName: Name of SQLServer
  8. '             State: Member of ServiceState Enum 
  9. '                     (see declarations)
  10. '             UserID: LoginID for SQL Server
  11. '             Password: Password for SQL Server
  12. '
  13. 'RETURNS:     True if successful, false otherwise
  14. 'REQUIRES:     Reference to Microsoft SQLDMO object library
  15. 'EXAMPLE:     ToggleSQLService "MyServer", et_Stop, -
  16. '                 "sa", "myPassword"
  17. '******************************************
  18. Dim oSQLServer As New SQLDMO.SQLServer
  19. If State < et_Stop Or State > et_Start Then Exit Function
  20. On Error GoTo ErrorHandler
  21. With oSQLServer
  22.     .Start False, ServerName, UserID, Password
  23. Select Case State
  24.     Case et_Stop
  25.         .Stop
  26.     Case et_Pause
  27.         .Pause
  28.     Case et_Start
  29.         .Continue
  30.     End Select
  31. End With
  32. ToggleSQLService = True
  33. ErrorHandler:
  34. Set oSQLServer = Nothing
  35. End Function
  36.  


i write this function on my programe then on a clikevent of a button i write this to call a functio
Expand|Select|Wrap|Line Numbers
  1.  
  2. ToggleSQLService "MyServer", et_Stop, "sa", ""
  3.  
  4.  
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
Mar 24 '08 #1
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
Mar 24 '08 #2
muddasirmunir
284 Contributor
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
Attached Images
 
Mar 25 '08 #3

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

Similar topics

6
3475
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"
3
2399
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"> <!--
4
4067
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
1
2468
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...
3
2045
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
4
3548
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;
7
2236
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/
1
7560
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...
5
2323
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));
5
1729
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()
0
9591
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,...
0
10343
jinu1996
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...
1
10331
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,...
0
9166
agi2029
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...
1
7631
isladogs
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...
0
6861
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();...
0
5529
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...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3001
bsmnconsultancy
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...

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.