In my C# project, I have a Data Set called Employee and an
EmployeeTableAdapter.
The EmployeeTableAdapter created a "Fill,GetData()" Query for itself, and it
uses this to display data to my DataGridView. The properties of the Fill
Query are:
CommandText = SELECT ...
CommandType = Text
ExecuteMode = Reader
Whenever my Form loads, it calls:
this.EmployeeTableAdapter.Fill(this.Jp2DataSet.Employee);
I have created additional queries to return select pieces of data. These are:
FillMethodName: FillAssignmentList
CommandText = dbo.AssignmentListProcedure
CommandType = StoredProcedure
ExecuteMode = Reader
FillMethodName: FillGroup
CommandText = dbo.GroupSelect
CommandType = StoredProcedure
ExecuteMode = Reader
With this information set, how would I now go about calling one of these
stored procedures?
Is using Stored Procedures this way good or bad?
If I switched my CommandType to Text, what would change in the way I called
the query?
I've looked on the MSDN site, but the many links I've found don't seem to
answer how I would programatically call queries and procedures that I have
added to my table adapters.
Thanks for your help, and your time.
Cor Ligthert[MVP] - 26 Jan 2008 06:57 GMT
The stored procedure in the commandText has to be inside quotes.
your other question,
There is no prefered method in Net.
With small projects I like the SQL code (or Linq) inside the classes,
because then it is easily maintanable, with hug projects where you need
often to use the same SQL code I like stored procedures because changes in
databases are easy to affect in the procedures.
One thing that you should never do in my idea is mixing this up. That gives
only confusion
Cor