mapping error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • little83
    New Member
    • Feb 2009
    • 26

    #1

    mapping error

    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.T oString());
    string query1 = string.Format(" CREATE LOGIN [{0}] WITH PASSWORD = '{1}' , CHECK_EXPIRATIO N=ON, CHECK_POLICY=ON ", textBox6.Text.T oString(), textBox7.Text.T oString());
    string query2 = string.Format(" USE [{0}] CREATE USER [{1}] for LOGIN [{1}]", textBox5.Text.T oString(), textBox6.Text.T oString());
    string query3 = string.Format(" USE [{0}]; exec sp_addrolemembe r ['db_owner'], ['{1}'];", textBox5.Text.T oString(), textBox6.Text.T oString());
    [\CODE]

    Any ideas?
Working...