Click here to Skip to main content
15,890,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public DataTable ExecuteSelectCommand(SqlCommand command)
    {
        DataTable table = new DataTable();
        SqlDataAdapter sda = new SqlDataAdapter(command);
        sda.Fill(table);
        return table;
    }


i dont understand public DataTable ExecuteSelectCommand(SqlCommand command) without any query in code
Posted
Updated 25-Aug-14 3:52am
v2
Comments
Thanks7872 25-Aug-14 9:53am    
Everytime you will call this method with Command object and in response you will get the data in form of DataTable.

What is something in this code which is still not clear?

1 solution

"ExecuteSelectCommand" is a function which will call in main page code or button code which results a table data. "Command" - a parameter which will pass form a main page or button code where you are using this function.

"ExecuteSelectCommand" function return table that's why it's data type is DataTable.

Coming to "Public" it is a access quantifier in C# indicate you can use this function any where in the program or project where you call this class or object.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900