A Wrapper Class for the SQL Server Based Data Access Helper - Getting multiple rows using wrapper methods from the data access helper
(Page 3 of 7 )
The following is the wrapper method used to retrieve more than one row:
PublicFunction getDataTable(ByVal sqlSELECT As String) As System.Data.DataTable
Try
ObjLib = getDBHelperObject()
Return ObjLib.getDataTable(sqlSELECT)
Catch ex As Exception
Throw ex
Finally
Try
System.EnterpriseServices.ServicedComponent.DisposeObject(ObjLib)
Catch ex As Exception
End Try
End Try
End Function
The above returns only a data table. If you need a return in the form of a dataset, you need to modify the same as follows:
PublicFunction getDataSet(ByVal sqlSELECT As String, Optional ByVal DataTableName As String = Nothing) As System.Data.DataSet
Try
ObjLib = getDBHelperObject()
Return ObjLib.getDataSet(sqlSELECT)
Catch ex As Exception
Throw ex
Finally
Try
System.EnterpriseServices.ServicedComponent.DisposeObject(ObjLib)
Catch ex As Exception
End Try
End Try
End Function
If you need a return in the form of a data view, you need to modify the same as follows:
PublicFunction getDataView(ByVal sqlSELECT As String) As System.Data.DataView
Try
ObjLib = getDBHelperObject()
Return ObjLib.getDataView(sqlSELECT)
Catch ex As Exception
Throw ex
Finally
Try
System.EnterpriseServices.ServicedComponent.DisposeObject(ObjLib)
Catch ex As Exception
End Try
End Try
End Function
Next: Adding wrappers for transactions >>
More MS SQL Server Articles
More By Jagadish Chaterjee