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

  • Home
  • SEARCH
  • 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 3751836
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:07:50+00:00 2026-05-19T09:07:50+00:00

I create a database using ADO.NET SQL queries like this: create database mydatabase create

  • 0

I create a database using ADO.NET SQL queries like this:

create database mydatabase
create login 'loginname' with password='somepassword'
create user 'username' for login loginname

The queries aren’t exact, I’ve typed them as far as I could remember them.
After that I don’t see the database in my ms sql server 2008 r2 express management studio.
I also can’t log in with the newly created login. The “enable server authentication” is set to true.
What should I do to see that database in the manager?
Why can’t I log in with newly created login? I’ve looked into the logs and it says that the password is incorrect.

I do have 2 sql express instances, but I use the same one when I run my sql
select @@servername when run in management studio returns “BOGDAN”.
ADO.NET query returns “BOGDAN\BBF17ECB-69FF-4B” . Code is below:
SqlConnection con = new SqlConnection(“Data Source=BOGDAN;Integrated Security=True;User Instance=True”);
SqlCommand cmd = new SqlCommand(“select @@servername”, con);
con.Open();
string s = (string)cmd.ExecuteScalar();
Console.WriteLine(“Server name:” + s);
con.Close();
Console.ReadKey(false);
Don’t know where BBF17ECB-69FF-4B came from, I explicitly stated server name as “BOGDAN”.

the script is:
IF DB_ID(‘MyDatabase’) IS NULL CREATE DATABASE [MyDatabase]
USE MyDatabase
IF NOT EXISTS(SELECT * FROM master.dbo.syslogins WHERE loginname = ‘AUsername’) CREATE LOGIN AUsername WITH PASSWORD=’APassword’
IF NOT EXISTS (SELECT * FROM sys.sysusers WHERE name=’AUsername’) CREATE USER AUsername FOR LOGIN AUsername
EXEC sp_addrolemember N’db_owner’, N’AUsername’

  • 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-19T09:07:51+00:00Added an answer on May 19, 2026 at 9:07 am

    The problem was with the connection string: I had to remove “User Instance=true” from it. That fixed the problem!
    I thought the problem was with how I configurated the servers or with the SQL requests.

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

Sidebar

Related Questions

Is it possible to create an SQL server database backup using c# ADO.net and
I've created a database application using C#, ADO.Net and an embedded MS SQL 2008
How to create a database using connector/net programming? How come the following doesn't work?
How to create reasonable expression to store password in database using Doctrine and Zend_Auth::setCredentialTreatment()
I am using SQL Server 2008 Enterprise. And using ADO.Net + C# + .Net
I am using SQL Server 2008 Enterprise. And using ADO.Net + C# + .Net
I'm using Quartz.NET with a database, i.e. ADO.NET. Problem is, when my jobs are
I am using ADO.Net for connecting to some Sql Server and Oracle databases, and
currently i create dynamic database using CreateDatabase() method in Entity Framework. it executes sucessfully
Q1 A) Is there a way to create membership database ( using aspnet_regsql tool

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.