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

Please support our MS SQL advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Nov 2009
Posts: 6
Reputation: lukeser is an unknown quantity at this point 
Solved Threads: 0
lukeser lukeser is offline Offline
Newbie Poster

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

 
0
  #1
15 Days Ago
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
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 72
Reputation: gusano79 is on a distinguished road 
Solved Threads: 5
gusano79 gusano79 is offline Offline
Junior Poster in Training
 
0
  #2
15 Days Ago
Originally Posted by lukeser View 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.
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.
--smg
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 6
Reputation: lukeser is an unknown quantity at this point 
Solved Threads: 0
lukeser lukeser is offline Offline
Newbie Poster
 
0
  #3
14 Days Ago
Originally Posted by gusano79 View Post
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.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC