TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
petre ricardo
NA
194
0
regarding TableData Adapters?
Oct 14 2009 1:54 PM
Hi,
As recommended by MS, i use the Designer to create Optimistic concurrency enabled DAL.
In it we have to create a Table Adapter, i can understand up to "Choose methods to Generate" where i give name for method that fills the Data table and Name the method that returns the DataTable. by default thsi is set to Fill() and GetData().
I use stored "use existing stored procedures" in the "chose command type" dialog. After click to finish it added the
following line in the designer table "Fill" and "GetData( )".
I have few question regarding the table that is created:
When i use the stored procedure the table name of the designed table (the table like Icon that displays on the .XSD), the table name is assigned with the name of the stored procedure. the method i create in the designer GetData() assigned values to select, update, Insert and delete commands. THis GetData() will return all the rows of the table.
Assume i need to create a search method that will search an item by index and i want to name it as GetItemsByIndex(Index), i have to right click on the
TableDataAdapter --> add Query --> select from existing Stored Procedure
à
Select the new stored procedure that search from index
à
select tabular data
à
named the fill and Getdata methods
à
finish
When I click Finish it throws this error : "The new command text returns data with schema different from schema of the main query, check your queries command text is this is not desired ",
ERROR:
When I do preview of the data of the data returned by GetItemsByIndex() by right click
à
preview data it doesn't display the data properly.
But when I create a new DataTable in the .XSD with a new
TableDataAdapter
then I create a new method to fetch data then only it works.
I don't understand why I can only add one method (a GetData method) with Optimistic concurrency and if I need to add another (assume GetItemByIndex(index))
I need to create a another table with a new TableDataAdapter,
How do I add more than one method that will return table data with optimistic concurrency under on TableDataAdapter?
Reply
Answers (
1
)
DB-Direct and batch update patterns in designing DAL?
How do i write code to handle exceptions in the DAL if i use the designer to create DAL?