Ja wlaśnie daję domyślnie sqlexpress, ale niestety dodaję taki error:
"Cannot open server 'sqlexpress' requested by the login. Client with IP address 'adresIP' is not allowed to access the server. To enable access, use the Windows Azure Management Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range. It may take up to five minutes for this change to take effect."
Jakiś pomysł? Bo pierwszy raz mi się cos takiego dzieje.
try
{
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
builder.DataSource = "sqlexpress.database.windows.net";
builder.UserID = "DESKTOP-HHM64OC\user1";
builder.Password = "";
builder.InitialCatalog = "dbo.NazwaBazy";
using (SqlConnection connection = new SqlConnection(builder.ConnectionString))
{
Console.WriteLine("\nQuery data example:");
Console.WriteLine("=========================================\n");
String sql = "SELECT Name FROM dbo.NazwaTabeli";
using (SqlCommand command = new SqlCommand(sql, connection))
{
connection.Open();
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
Console.WriteLine("{0} ", reader.GetString(0));
}
}
}
}
}
catch (SqlException e)
{
Console.WriteLine(e.ToString());
}
Console.ReadLine();