Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
This question is regarding the ASP.NET webservice that i am creating using the DAL-BLL architecture for my final school project.

Here is some more information:
I am using the SQL dataset (.xsd) in DAL. So i have a datatable called "Insurance", which has a tableAdapter. One of the queries in the adapter references to a stored procedure, which has an inner join. So my SP looks like:
SQL
ALTER PROCEDURE dbo.GetInsurancesPaged
       (
           @startRowIndex int,
           @maximumRows int,
           @patientID int
       )
   AS
       select * from
       (
       SELECT Insurance.insuranceID, Insurance.memberID, Insurance.groupID, Insurance.accountType, Insurance.comments, Insurance.patient, Insurance.company, InsuranceCompany.companyID, InsuranceCompany.companyName, InsuranceCompany.address, InsuranceCompany.phone, InsuranceCompany.fax, ROW_NUMBER() over (order by Insurance.dateModified DESC) as ROWRANK
   FROM Insurance INNER JOIN InsuranceCompany ON Insurance.company = InsuranceCompany.companyID
   WHERE Insurance.patient = @patientID
       )
       AS DataWithRowNumbers
   WHERE ROWRANK > @startRowIndex AND ROWRANK <= (@startRowIndex + @maximumRows)


So this SP returns a datatable which will be a combination of the 2 tables in the inner join.

Now in my BLL, i have:
C#
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public mySys.InsuranceDataTable GetInsurancesPaged(int startRowIndex, int maximumRows, int patientID)
        {
           return insAdapter.GetInsurancesPaged(startRowIndex, maximumRows, patientID);
        }

where insAdapter is an instance of insuranceTableAdapter

This gives an error on execution.

I can execute the SP successfully, so i think the problem is only because i am trying to return a wrong datatable from the BLL. Help greatly appreciated.
Posted
Updated 28-Jul-10 19:08pm
v2
Comments
Sandeep Mewara 29-Jul-10 1:09am    
Next time, use PRE tags to format code part. It makes the question readable.

1 solution

Found a solution :)
Finally got it working.

I created a new table adapter using the Dataset designer, and called the SP as one of the queries there. The datatable thus created, has all the fields (from Insurance and InsuranceCompany) included. Now, ASP.NET can detect that the return type is the newly created datatable.
Works like a charm.

If there is a better way to solve this, please comment.

Thank you all for your time.
Thanks Sandeep for making my question more readable.
 
Share this answer
 
Comments
raju melveetilpurayil 30-Jul-10 3:54am    
updating answer is good. it will help others.

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