0

I have a storedProcedure with joining four table . I want to bind the result from different table in a gridview control.

here is my data access layer code

aCommand = new SqlCommand("spViewPatientHistory", aConnection);
aCommand.CommandType = CommandType.StoredProcedure;
aCommand.Parameters.Add("@PatientId", SqlDbType.Int).Value = patientId;
aCommand.Parameters.Add("@FirstName", SqlDbType.VarChar).Value = firstName;
aCommand.Parameters.Add("@LastName", SqlDbType.VarChar).Value = lastName;
aDataAdapter = new SqlDataAdapter(aCommand);
aDataAdapter.Fill(aDataSet);
aConnection.Close();

and this is my business logic code

aHistoryPatientDataTable = aDataAccess.GetSearchPatientHistory(patientId,firstName,lastName);

In business logic it show a error

Cannot convert dataset to dataTable . How to solve it ?

Gericke
  • 2,109
  • 9
  • 42
  • 71

1 Answers1

0

Little bit ambiguous question due to lake of code but i think you are returning dataset and assigning dataset to dataTable

use your code like that

aHistoryPatientDataTable = aDataAccess.GetSearchPatientHistory(patientId,firstName,lastName).GetDataSet().Tables[0];

Hope this will help