Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / January 2008

Tip: Looking for answers? Try searching our database.

Using Visual Studio Queries

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jp2msft - 25 Jan 2008 18:53 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.