Hi,
Simple example. Adds a user to the northwind database.
Imports System.Data.SqlClient
Module Module1
Sub Main()
Dim conn As SqlConnection
Dim cmd As SqlCommand
Dim strConn As String
strConn = "Server = " & Environment.MachineName
strConn += "\VSdotNET; Database = NorthWind; Integrated Security = SSPI;"
conn = New SqlConnection(strConn)
conn.Open()
cmd = New SqlCommand("sp_grantdbaccess 'Ken'", conn)
cmd.ExecuteNonQuery()
conn.Close()
End Sub
End Module
Ken
---------------------
"Mark" <he****@vbtek.co.uk> wrote in message
news:c6**********@sparta.btinternet.com...
Hi all,
Can anyone tell me how I can add a new user to an existing SQL Server 2000
database programmatically using vb.net.
Any help will be very much appreciated. I have had a good Google around
but have been unable to find anything.
Many thanks in advance.