Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am new to SQL Server. I often find scripts over internet to perform different functions with SQL Server but I donot know how to use them in vb.net.

For example I want to run the following code through my vb.net application, but do not know how to do so. Please advise

SQL
ALTER LOGIN sa ENABLE ;
GO
ALTER LOGIN sa WITH PASSWORD = '<enterStrongPasswordHere>' ;
GO
Posted
Updated 15-Feb-12 7:32am
v2

1 solution

You need to researching using a SQLConnection and SQLCommand. You setup a connection string for your SQLConnection, set the SQLCommand.CommandText and then add any SQLParameters if necessary. There is a lot to do so you need to get started and then ask something more specific if you have issues.
 
Share this answer
 
Comments
fjdiewornncalwe 15-Feb-12 13:54pm    
Good answer. Just a small addition, though: In order for the sql statements quoted (ALTER), you will just need to ensure that the credentials used in your SQLConnection have sufficient privileges in the database to run the statement.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900