473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Add user to SQL Server 2000 using vb.net

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.
Nov 20 '05 #1
3 1983
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.

Nov 20 '05 #2
Many Thanks Ken.

Will this still work without using Integrated Security ?
The app I am developing will use SQL Usernames and Passwords.

Thank you again..... Mark
Nov 20 '05 #3
Hi,

Yes.

Ken
------------------
"Mark" <an*******@discussions.microsoft.com> wrote in message
news:81**********************************@microsof t.com...
Many Thanks Ken.

Will this still work without using Integrated Security ?
The app I am developing will use SQL Usernames and Passwords.

Thank you again..... Mark

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jach | last post by:
How can I get the domain, username and PC network name (Win 2000 Pro & Win XP Pro PC's) of the current logged on user (logged onto a domain and access an intranet page, Window 2000 server running...
1
by: Tom Dauria | last post by:
I have a SQL database with an Access front end. In the database I have a read only and a read write role. When a read only user opens the database I want all the fields on the form to be locked...
1
by: VC | last post by:
Hello, I have an issue here. Hope someone can help me. Issue: Developer is using a web application from one server (IIS) (say Server A). A second server (say Server B, which is SQL Server...
13
by: dawatson833 | last post by:
I have several stored procedures with parameters that are defined with user defined data types. The time it takes to run the procedures can take 10 - 50 seconds depending on the procedure. If I...
3
by: Maellic | last post by:
Hi, The website I am working on is built with ASP.NET and connects to a SQL Server 2000 database. The web server and database are on the same machine. I have recently tried to modify the timeout...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
5
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in...
2
by: J | last post by:
Hello. I apologize if this isn't the appropriate group for this question but I was wondering if it's possible to allow regular windows domain users to change their passwords through an .asp page? ...
1
by: billharrison9 | last post by:
I need to be able to drop a table after a user is done with it. I have tried something like, DROP TABLE USER.tblEducation_SAP1 but I get an error. Can someone suggest the way I should be...
1
by: Srinivas Chintakindi | last post by:
Hi All, I am developing one ASP.NET 2.0 application in which user test the remote sql server existance. User enters remote sql server name, data base name, authentication mode, user name,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...

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.