In ObjectDataSource we have a method called SelectMethod and TypeName in which we can specify a method to select data from.
But what is the equivalent method in SqlDataSource to speicify a method for data to select from. If there is no such method, how can I specify a method to select data like in ObjectDataSource
<asp:ObjectDataSource ID="ObjEmployees" runat="server"
SelectMethod="GetEmployees" TypeName="AllowPaging.GetData">
</asp:ObjectDataSource>
SqlConnection connection = new SqlConnection("server=NIPUNA-PC\\SQLEXPRESS; database=KTD; Trusted_Connection=yes;");
string commandText = "SELECT * FROM [Emp]";
public DataSet GetEmployees()
{
SqlCommand cmd = new SqlCommand(commandText, connection);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
return ds;
}