Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7504009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:25:28+00:00 2026-05-29T21:25:28+00:00

Please see the pic. I am attaching DBs using following code. Dim conn As

  • 0

Please see the pic. I am attaching DBs using following code.

Dim conn As New SqlConnection("Server=MyHomeServer\SQLExpress;Database=master;Integrated Security=SSPI")
    Dim cmd As New SqlCommand("", conn)
    cmd.CommandText = "CREATE DATABASE dbNoPWD ON ( FILENAME = 'd:\dbNoPWD.mdf' ), ( FILENAME = 'd:\dbNoPWD_log.ldf' ) FOR ATTACH"
    conn.Open()
    cmd.ExecuteNonQuery()
    cmd.Dispose()
    conn.Dispose()

Please note I donot want to give any username and password.

When I ran the above code and then checked SSMS, I found my attach DB was not checked in Roles (pls. see pic.)
enter image description here
The problem with this is my network computers can not access this DB. I want to run some code like above (without sa password) and want that all my network computers can access the DB without my user get involved in setting up SSMS.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T21:25:30+00:00Added an answer on May 29, 2026 at 9:25 pm

    In your connection string when creating the database you’re using windows authentication. Therefore if your ActiveDirector account is JOE then the owner of the dbNoPWD database will be JOE, not SA. That’s why your screenshot shows SA with no mapping to the dbNoPWD.

    But here’s your problem: SA’s mappings have nothing to do with whether or not other SqlServer logins will be able to access your database (unless they belong to the sysadmin server role). Each SQLServer login must have it’s own mapping to your new database or else they won’t be able to use it.

    So, let’s solve your problem. If you want people to have read/write access to your new database add some TSQL after your database creation statements to map users to your new database. Something like this:

    use dbNoPWD
    go
    exec sp_addrolemember db_datareader, SQLLOGINNAME
    go
    exec sp_addrolemember db_datawriter, SQLLOGINNAME
    go
    

    If you have a lot of users an easier way it to create logins for entire windows groups and then just assign mapping for the entire group to your database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see the code below: #include <iostream> #include <stdlib.h> #include <time.h> using namespace std;
Please see the following code: def good(): foo[0] = 9 # why this foo
please see the following code // redirect to success page if ($success){ header( 'Location:
Please see the following code: NSString *pdfPath = [documentsDirectory stringByAppendingPathComponent:@test.pdf]; NSData *myData = [NSData
please see the following pic: the client initiate a half-close request and get acknowledged,if
Please see code below. The destructors are never called. Anyone know why and how
Please see this piece of code: #include<stdio.h> #include<string.h> #include<stdlib.h> int main() { int i
Please see following methods. public static ProductsCollection GetDummyData(int? customerId, int? supplierId) { try {
I have sql server procedure, please see below. ALTER PROCEDURE [dbo].[uspInsertDelegate] ( @CourseID int,
please see: http://pastebin.com/5za3uCi1 I'm quite new to php and I'm editing the ventrilo status

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.