473,395 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

MsSQL Database browser

How can i browse database name and server to connect?
Apr 3 '13 #1

✓ answered by r035198x

Outside .NET you would run the
Expand|Select|Wrap|Line Numbers
  1. EXEC sp_databases
sql.
In .NET you can use the SQL Server Managed objects see guide here http://msdn.microsoft.com/en-us/library/ms162169.aspx

Then you can get the server using

Expand|Select|Wrap|Line Numbers
  1. server = new Microsoft.SqlServer.Management.Smo.Server("localhost");
and the databases using
Expand|Select|Wrap|Line Numbers
  1. server.Databases

3 1664
r035198x
13,262 8TB
To query the database for other objects you need to connect to it first. Usually one knows the server name and the database name. So you don't know both? So what information do you currently have about the database? If you have nothing then ask the person that installed the database.
Apr 3 '13 #2
i know server name(actually it is localhost), but database create user and name can be various.
so i have connection line:
Expand|Select|Wrap|Line Numbers
  1. SqlConnection connection = new SqlConnection("Data Source=(local)\\DB_name;Initial Catalog="can_be_various";Integrated Security=True");
I need to browse Initial Catalog of my DB
Apr 3 '13 #3
r035198x
13,262 8TB
Outside .NET you would run the
Expand|Select|Wrap|Line Numbers
  1. EXEC sp_databases
sql.
In .NET you can use the SQL Server Managed objects see guide here http://msdn.microsoft.com/en-us/library/ms162169.aspx

Then you can get the server using

Expand|Select|Wrap|Line Numbers
  1. server = new Microsoft.SqlServer.Management.Smo.Server("localhost");
and the databases using
Expand|Select|Wrap|Line Numbers
  1. server.Databases
Apr 3 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Manuel | last post by:
Hello, I try to export a mssql database into a csv-file. I tried this with asp, but it doesn't work. <% Dim objConn Dim csv_path
0
by: Rookie Card | last post by:
Issue - Reformating the Dates in ASP.NET from a MSSQL Database that has <NULL> values in a SmallDateTime Field to read "Dec 8, 2000" instead of "12/8/2000 12:00:00 AM" (As you might already...
0
by: Nicolas | last post by:
please how to synchronise mssql database from db2/400 ? I whish I have my db2/400 database as master and replicate it in an mssql server 2005 for reading thanks Nicolas
9
by: Advo | last post by:
Im having major problems trying to connect to a mssql database thats hosted on our server. I've got the ip, username, password and database name, yet no matter what i try, I cant seem to...
3
bhing
by: bhing | last post by:
Ciao!!.. I am currently working with mysql database now and i am trying to get some fields in the mssql database.table.. I want to automatically add those fields to my mysql database table, or if...
0
by: raremind | last post by:
First, I need to point out I am very new to programming so please bear with me. I was curious if there was anyway to create ASP.Net forms on the fly using data from tables in a MSSQL database....
7
by: ScottieFromNM | last post by:
I am trying to post values into a mssql database and having some trouble. I create a detail_id in the first query and want to pass this detail_id to several other queries to insert into several other...
1
kwaxy
by: kwaxy | last post by:
Hey Frendz, I can upload files into MS Access database, but unable to upload files to MSSQL database using ASP, can anyone help me plz ????
0
by: anjali123 | last post by:
Hi, I want to prepare crystal reports for my project. I am using the database that is inbuilt with the visual studio (MSSql Database file). I didnt know what to choose as datasource to create a...
1
by: suhad | last post by:
I develop ASP.NET website using VWD and SQLserver 2005 when I try to deploy my web site I dont know the connection string information of the server (database name ,username ,password,server name)and...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.