I did some coding on connecting data using Azure database on Windows Form and when I tried to retrieve the data, I received the following error:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll.
Also in addition, I received a Login failed for user ''. When I tried to retrieve the data and located at myConnection.Open();
private void btnRetrieve_Click(object sender, EventArgs e)
{
//Create a connection calling the App.config
string conn = ConfigurationManager.ConnectionStrings["NYPConnection"].ConnectionString;
//The query to use
string query = "SELECT * FROM Users";
SqlConnection myconnection = new SqlConnection(conn);
//Create a Data Adapter
SqlDataAdapter dadapter = new SqlDataAdapter(query, myconnection);
//Create the dataset
DataSet ds = new DataSet();
//Open the connection
******myconnection.Open();******
//Fill the Data Adapter
dadapter.Fill(ds, "Users");
myconnection.Close();
//Bind the datagridview with the data set
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "Users";
}