PDA

View Full Version : مشکل در یافتن سرور در سی شارپ



ordebehesht
شنبه 26 اسفند 1391, 20:33 عصر
مشکل این کد چیه چرا سرور محلی رو برام پیدا نمیکنه


private void ServerFind()
{
// Create a DataTable where we enumerate the available servers
DataTable dtservers = SmoApplication.EnumAvailableSqlServers(true);
// If there are any servers at all
//the parameter true passed tell this server is local no on network server.
// If there are any servers at all
if (dtservers.Rows.Count > 0)
{
// Loop through each server in the DataTable
foreach (DataRow drserver in dtservers.Rows)
{
// Add the name to the combobox
cmbServer.Items.Add(drserver["Name"]);
}
}
else
{
MessageBox.Show("No", "Test");
}
}