944,100 Members | Top Members by Rank

Ad:
  • MS SQL Discussion Thread
  • Marked Solved
  • Views: 966
  • MS SQL RSS
Nov 6th, 2009
0

Tables appear under wrong database in SQL Server Mgmt. Studio Express

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
lukeser is offline Offline
6 posts
since Nov 2009
Nov 6th, 2009
0
Re: Tables appear under wrong database in SQL Server Mgmt. Studio Express
Click to Expand / Collapse  Quote originally posted by lukeser ...
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.
Reputation Points: 182
Solved Threads: 72
Posting Pro in Training
gusano79 is online now Online
476 posts
since May 2004
Nov 7th, 2009
0
Re: Tables appear under wrong database in SQL Server Mgmt. Studio Express
Click to Expand / Collapse  Quote originally posted by gusano79 ...
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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
lukeser is offline Offline
6 posts
since Nov 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MS SQL Forum Timeline: Retrieve row based column having null value in sql2000
Next Thread in MS SQL Forum Timeline: Smart Searches





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC