<WebMethod()> Public Function RetrieveRecord(ByVal strSQL As String, ByVal strDatabase As String) As DataSet

 

        '************ SAMPLE USAGE IN A Client App *************************************************************

        'Dim objDBO As New localhost1.DatabaseOperations()

        'Dim ds As DataSet

        'ds = objDBO.RetrieveRecord("Select * From Candidate Where ssn = '123456789'","c:\inetpub\wwwroot\cp\cp.mdb")

        'If ds.Tables("Table1").Rows.Count > 0 Then

        '   txtInfo.Text = "Last Name Of " & ds.Tables("Table1").Rows(0).Item("Lname") & " Was Found."

        'Else

        '   txtInfo.Text = "No Records Found."

        'End If

        '**********************************************************************************************************

 

        Dim objDs As New DataSet()

        Try

            '******************* OPEN A DATABASE ****************************************************

            'Could Be In Global Area ****************

            Dim objConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & strDatabase)

            Dim objCommand As New OleDbCommand()

            Dim objDa As New OleDbDataAdapter()

            Dim objCommandBuilder As New OleDbCommandBuilder()

            ' **********************************************

            objCommand.CommandText = strSQL

            objCommand.Connection = objConn

            objDa.SelectCommand = objCommand

            objDa.Fill(objDs, "Table1")

            '***********************************************************************************************

        Catch err As Exception

            Return objDs

        End Try

        Return objDs

 

    End Function