Today we
will discuss about Get SQL Server Name in C#.net
Get SQL
Server Name:
Add
Three References in your Project
·
Microsoft
.SqlServer.ConnectionInfo
·
Microsoft
.SqlServer.management.Sdk.sfc
·
Microsoft
.SqlServer.Smo
Declare namespace:
using Microsoft.SqlServer.Management.Smo;
Drag and Drop ComboBox in your form.
DataTable dataTable1 = SmoApplication.EnumAvailableSqlServers(false);
cmbServerName1.ValueMember = "Name";
cmbServerName1.DataSource = dataTable1;