I have a Class in the App_code folder that contain Method like this:
public static GetAllCustomers()
{
string conn = ConfigurationManager.ConnectionStrings["ConnectToDB"].ConnectionString;
using (SqlConnection connection= new SqlConnection(conn))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "select C_ID,L_ID,C_Name from Customer";
cmd.Connection = connection;
connection.Open();
}
}
return;
Sumit Kesarwani
05-Sep-2014You can return a System.Data.DataTable and use column names for datatextfield and datavaluefield.