i have a Class called “Services” 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 ???;
what should i use in the “????” as return type…because i want to bind dropdownbox.datasource to ???? and use the datavaluefield and datatextfield..
so should i make the method return datatable class or something else..
i hope i made my question clear..
You can return a System.Data.DataTable and use column names for datatextfield and datavaluefield.