Whenever I create a new database from a C# program and create tables for that database, the tables always show up under the creator's default database instead of being listed under the newly created database. This observation is from Microsoft SQL Server Management Studio Express. Is there some setting in Microsoft SQL Server Management Studio Express that I may apply to the users to remedy this?

FYI: SQL Server 9.0.3042
SQL Server Management Studio Express 9.00.2047.00

Recommended Answers

All 2 Replies

Whenever I create a new database from a C# program and create tables for that database, the tables always show up under the creator's default database instead of being listed under the newly created database.

Hi again!

If you're using the same connection string that created the database to send the create table commands, remember there's no database specified on that connection. Once you've created the database, you'll have to create a new connection that specifies the new database's name. Use that connection to create the tables.

If that doesn't apply to what you're doing (i.e., you're already creating a new connection) or it doesn't solve the problem, please post the relevant code so we can help.

Hi again!

If you're using the same connection string that created the database to send the create table commands, remember there's no database specified on that connection. Once you've created the database, you'll have to create a new connection that specifies the new database's name. Use that connection to create the tables.

If that doesn't apply to what you're doing (i.e., you're already creating a new connection) or it doesn't solve the problem, please post the relevant code so we can help.

Bullseye! You nailed it gusano79. I reconnected with the new DB name and the table is where it should be. Thank you very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.