×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Kill Network Connection

Kill Network Connection

Kill Network Connection

(OP)
Respected Sir,

There are 3 clients attached with Server and network connection is shown like this



I want to disconnect all clients by Disabling network connection.
Is it possible with VFP codes?
Or is there any other method to disconnect clients from Sqlserver database.

Please

RE: Kill Network Connection

See VFP Help->Reference->Language Reference->Functions->SQLDisconnect()

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Kill Network Connection

(OP)
Sir my specific need is to Disable Network Connection with VFP Codes.
I want to disable network connection only on Server not on clients.

RE: Kill Network Connection

You said: "Or is there any other method to disconnect clients from Sqlserver database."

If you want to disconnect clients from SQL Server, don't disable the network, even if this server only runs SQL Server and no other service for clients, you likely will have a file share there sooner or later, too, or other things. You usually never completely disconnect a server from the network unless you want to replace it completely.

To disconnect all users there are several solutions per database, but the obviously simplest would be stopping the SQL Server service.

On the server you need a cmd script doing

CODE

net stop servicename 

Where servicename needs to be the servicename for SQL Server, that can vary with versions, get an overview simply in the taskmanager.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Kill Network Connection

(OP)
Thanks sir
But how to run this command with vfp?

RE: Kill Network Connection

CODE

RUN net stop service 

This is an administrative task and you will not be able to run this from a client anyway, it has to stop the service on the server so it has to run there.
It wouldn't make sense to compile this into an EXE you put on the server, when you start it from a client it will still not run on the server, you need to have a way of acting on the server itself and you wouldn't install VP runtimes or your app there, you would let an admin do that.

Just like with the network this is something that wouldn't be advisable anyway if the SQL Server also has other databases for other applications you don't want to interrupt the whole server as hardware nor as SQL Server.

What do you plan to do? If you want to alter the database, you can do that without exclusive single user access, Backup? Same.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Kill Network Connection

Thank you, Mike.

Yes, I edited my post. It won't help anyway, as said. To run something serverside you would at least not integrate it into the application you run clientside.

I'll see what Tariq actually wants to do. For different goals there are different solutions, eg you can establish an SQL Server Job to do a backup.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Kill Network Connection

It's certainly an odd idea to kill a network connection - particularly on a server you are probably talking to via RDP

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

RE: Kill Network Connection

You would actually have to sit at the physical server and want to do something locally.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Kill Network Connection

(OP)
Sir What service should I STOP to make network adapter disable?



While sitting on Server, I want to click Disable with VFP



Please

RE: Kill Network Connection

No, Disabling Ethernet & Wi-Fi is not done by stopping services. I was talking about SQL Server.

You sit on the server and you really just want to replace the need to make four clicks with one click?

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Kill Network Connection

(OP)
Sir Olaf Doschke
You mean I must stop SQLSERVICES instead of disabling networking connection to clients?

RE: Kill Network Connection

Dear TariqMemhmod.

Actually, the clean solution is to let clients close their connections with SQLDisconnect(). Whenever you'd cut off a server via disabling the network adapter or stopping the SQL Server service or disconnect just the connections to a specific database when putting it offline or in single-user mode, that is a disruption. Applications will throw errors when you do that, users end up with unsaved changes, not able to end tasks if you do that during business hours.

Be assured, I don't assume you'd do, you'd likely want to do all that after hours. But in today's world, admins don't sit at servers themselves to maintain them, not on the software level, you set them up for remote handling and then you obviously never diable adapters.

And as I already said you also don't need to disconnect users to do almost any task on SQL Server, including backups and database updates. I don't even know why anybody would want to do that aside from retiring a server. Or for hardware maintenance. And then you can even make it simpler to yourself, shut down the server. Do your hardware maintenance and turn it on again. Or if there is software maintenance you can only do offline. Then simply turn off the Wi-Fi router, remove cables and turn the server on, you'll be able to work on whatever and eventually turn it off again, bring back the ethernet cabling or Wi-Fi or both finally bring back the server.

So far I could only think you want this features to be embedded in your client-side application, but once you want to do administrative things, there are already all kinds of Windows out-of-the-box solutions, even if you want to automate some things done in one go, write Powershell or batch scripts for that, don't write an admin VFP EXE or PRG. If you're doing admin work and want to automate it, that's the domain of batch scripts and not VFP and I bet you find ready to use solutions in forums about server administration. Don't use VFP as your admin tool for tasks not about VFP.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close