By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,265 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,265 IT Pros & Developers. It's quick & easy.

mapping error

P: 26
dear all

I got the follwoing error while trying to create database user

The role ''db_owner'' does not exist in the current database.
Changed database context to 'try2'.

here the code

[code]
string query = string.Format("CREATE DATABASE [{0}]", textBox5.Text.ToString());
string query1 = string.Format(" CREATE LOGIN [{0}] WITH PASSWORD = '{1}' , CHECK_EXPIRATION=ON, CHECK_POLICY=ON ", textBox6.Text.ToString(), textBox7.Text.ToString());
string query2 = string.Format(" USE [{0}] CREATE USER [{1}] for LOGIN [{1}]", textBox5.Text.ToString(), textBox6.Text.ToString());
string query3 = string.Format("USE [{0}]; exec sp_addrolemember ['db_owner'], ['{1}'];", textBox5.Text.ToString(), textBox6.Text.ToString());
[\CODE]

Any ideas?
Mar 25 '09 #1
Share this question for a faster answer!
Share on Google+

Post your reply

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