企业管理器-〉安全性-〉登陆-〉新建登陆-〉输入用户名密码-〉数据库访问-〉hello、master打勾-〉分别在下面的角色允许中设置-〉ok

解决方案 »

  1.   

    新建一个用户,在企业管理器->security->logins中的该用户名上点右键,选属性在出来的对话框上选Data Access标签,里面可以设定对每个DB的访问权限
      

  2.   

    实在不好意思,没有说一下,一定要用sql语句,
      

  3.   

    我只知道这么多,希望有人能把完整答案贴出来exec sp_addlogin @loginame='ccc',@passwd='ccc',@defdb='hello'
    --创建帐号exec sp_grantdbaccess @loginame='ccc',@name_in_db='ccc'
    --对当前数据库有public访问GRANT
    在安全系统中创建项目,使当前数据库中的用户得以处理当前数据库中的数据或执行特定的 Transact-SQL 语句。语法
    语句权限:
    GRANT { ALL | statement [ ,...n ] } 
    TO security_account [ ,...n ]
    对象权限:
    GRANT
        { ALL [ PRIVILEGES ] | permission [ ,...n ] }
        { 
            [ ( column [ ,...n ] ) ] ON { table | view }
            | ON { table | view } [ ( column [ ,...n ] ) ]
            | ON { stored_procedure | extended_procedure }
            | ON { user_defined_function }
        } 
    TO security_account [ ,...n ] 
    [ WITH GRANT OPTION ] 
    [ AS { group | role } ]
      

  4.   

    --新增用户  
    exec  sp_addlogin  'test'            --添加登录  
    exec  sp_grantdbaccess  N'test'            --使其成为当前数据库的合法用户  
    exec  sp_addrolemember  N'db_owner',  N'test'            --授予对自己数据库的所有权限
      

  5.   

    --添加用户:  
    exec  sp_addlogin  '用户名','密码','默认数据库名'  
     
    --添加到数据库  
    exec  sp_grantdbaccess  '用户名','数据库名'  
     
    --分本权限  
    grant  insert,select,update,delete  on  table1  to  public