This is how i return Datatable
Then how to assign that datatable to list<> (is it possible to assign datatable to list<>) ??
public DataTable Vehiclelist(string Vehicle)
{
SqlCommand newCmd = conn.CreateCommand();
newCmd.Connection = conn;
newCmd.CommandType = CommandType.Text;
newCmd.CommandText = "SELECT * from where Vehicle_No ='" + Vehicle+ "'";
SqlDataAdapter da = new SqlDataAdapter(newCmd);
DataTable dt = new DataTable();
da.Fill(dt);
conn.Close();
return dt;
}
Above code segment read data from table and return as Datatable Then tell how to assign this datatable to List<> in Code behind or else tell how to read data as List<> from database