Here I am trying to bind ta data from shippers table to datagrid(DataGrid1)

.NET Classes used :

using System.Data.SqlClient;
using System.Collections;

Code:


public void BindGrid()
{
    try {
        sqlConn = new SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"));
        string strSQL = "SELECT ShipperID, CompanyName FROM Shippers ORDER BY CompanyName";
        SqlDataAdapter da = new SqlDataAdapter(strSQL, sqlConn);
        DataSet ds = new DataSet();
        da.Fill(ds);
        DataGrid1.DataSource = ds;
        DataGrid1.DataBind();
    }
    catch (SqlException ex) {
        Response.Write(ex.ToString());
    }
}