I cannot connect to SQL Server. Also, how do I fill drop-down List with dataSet
ASP.Net WebForm, Visual C#
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
PopulateList();
}
private void PopulateList()
{
SqlConnection myConnection = new SqlConnection("Persist Security Info = False; Integrated Security = SSPI; server = myServer; database = myDataBase; user = myUsername; password = myPassword");
myConnection.Open();
SqlDataAdapter query = new SqlDataAdapter("select columnName from tableName", myConnection);
DataSet ds = new DataSet("tableName");
query.Fill(ds);
myConnection.Close();
}
My connection failure is likely at the server permission level, unless someone sees a coding error.
Also, what code could I use to populate a ddl (drop-down list) with the data in the dataSet?
Can anyone help me?