Results 1 to 3 of 3

Thread: Does dbf recordset supports "INSERT INTO" statement?

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2004
    Posts
    36

    Does dbf recordset supports "INSERT INTO" statement?

    I have a dbf recordset and I need to add new records to it, as I tried "INSERT INTO" statement, I sometimes got an error message as "Selected Collating Sequence not supported by the operating system" and sometimes it's OK. Anyone knows why?


    -------

    Codes

    Option Explicit

    Private Sub Command1_Click()

    On Error GoTo errhandler
    '--------Establish DBF Connection--------
    Dim dbfconn As ADODB.Connection
    Dim rec As ADODB.Recordset
    Set dbfconn = New ADODB.Connection
    Set rec = New ADODB.Recordset


    '--------Make copy of dbf file--------
    Dim SourcePath As String
    Dim TargetPath As String
    Dim pathstring As String
    'SourcePath = pathstring & strSourceFile
    'TargetPath = pathstring + strTargetFile
    'FileCopy SourcePath, TargetPath
    Dim strQuery As String
    Dim RecsAffected As Long

    With CommonDialog1
    .Filter = "dbf file(*.dbf)| *.dbf"
    .ShowOpen
    End With

    Call OpenDBF(GetPath(CommonDialog1.FileName), "", dbfconn)
    strQuery = "SELECT * FROM " & GetName(CommonDialog1.FileName) & ".dbf;"
    'OPEN RECORDSET
    rec.Open strQuery, dbfconn, adOpenDynamic, adLockOptimistic

    MsgBox rec.RecordCount

    'EDIT
    strQuery = "INSERT INTO " & GetName(CommonDialog1.FileName) & ".dbf" & " (RWY_ID) VALUES ('11');"
    dbfconn.Execute strQuery, RecsAffected


    errhandler:
    MsgBox Err.Description
    End Sub

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Does dbf recordset supports "INSERT INTO" statement?

    What kind of database is this?

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Does dbf recordset supports "INSERT INTO" statement?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width