0

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

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by lukeser
0

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.

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.