Link to home
Start Free TrialLog in
Avatar of emi_sastra
emi_sastra

asked on

SOME SQL FUNCTION NOT ALLOWED WITH OLEDB CONNECTION

Hi All,

I try below code to transfer data from dbf to sql, some functions are not allowed.

ISNULL AND CASE RAISE ERROR.

 Private Function Isi_Detil_Data_From_DP() As DataTable
       
        sdbSQLCommand.AppendLine(" SELECT ")
       
        sdbSQLCommand.AppendLine(" ISNULL(A.CAB, '') AS KOAO")
        'sdbSQLCommand.AppendLine(", CASE A.CAB WHEN '99' THEN '1' ELSE '2' END AS  
       
        sdbSQLCommand.AppendLine(" FROM " & strFileNameA & " AS A")

         Dim strSQLCommand As String = sdbSQLCommand.ToString

        Try

            Dim accessDataSet As New DataSet()
            Dim accessConnection As New OleDbConnection(strDBFFileConnection)
            Dim accessAdapter As New OleDbDataAdapter(strSQLCommand, accessConnection)

            accessAdapter.Fill(accessDataSet, "Data")
            Return accessDataSet.Tables("Data")

        Catch ex As Exception
   
        End Try

        Return Nothing

    End Function

What should I do ?

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of emi_sastra
emi_sastra

ASKER

Hi CodeCruiser,

It works.

Thank you very much for your help.