Jump to content

read db column(memo) line by line from visual foxpro db


Recommended Posts

hi,

i use the following code to connect to a Visual Foxpro db:

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
$sqlCon = ObjCreate("ADODB.Connection")
    $sqlCon.Mode = 16 ; sharedenynone
    $sqlCon.CursorLocation = 3 ; client side cursor
    $sqlCon.Open("Provider=vfpoledb.1;Data Source=x:\DATA\;Collating Sequence=general;")
    if @error Then
        MsgBox(0, "ERROR", "Failed to connect to the database")
        Exit
    EndIf

    $sqlRs = ObjCreate ("ADODB.Recordset")
    if not @error Then
        $sqlRS.open("select IDENT, PICTURES from gbmas.dbf where STATUS = 'I'", $sqlCon)
        if not @error Then
            ;Loop until the end of file
                While Not $sqlRS.EOF
                    ;Retrieve data from the following fields
                    $OptionName = $sqlRS.Fields('IDENT').Value
                    $OptionVal = $sqlRS.Fields('PICTURES').Value


                      Local $sFileRead = FileReadLine($OptionVal, 1)
                     MsgBox($MB_SYSTEMMODAL, "", "First line of the file:" & @CRLF & $sFileRead)
                    ;MsgBox(0, "Record Found", "Nummer: " & $OptionName & @CRLF & "GTYP: " & $OptionVal)
                    $sqlRS.MoveNext
                    WEnd
            $sqlRS.close
            $sqlCMD = ObjCreate("ADODB.Command")

            $sqlCMD.ActiveConnection = $sqlCON
            $sqlCMD.CommandText = "update Opts.dbf set value = '.F.' where name = 'Option1'"
            $sqlCMD.Execute

        EndIf
    EndIf

the column "Pictues" have multiple rows with unc paths.

i want to read the content of the column "pictures" line by line to copy the unc files to another destionation with filecopy.

i start to try with fileread line. but it does not work.

Any ideas ?

many thanks

mike

the content of column pictures looks like:

U:\Bilder\Neumaschinen\P1080219.JPG
U:\Bilder\P1080198.JPG
U:\Bilder\P1080201.JPG
U:\Bilder\30-TTR4400-II\P1080204.JPG

 

 

 

 

Edited by mike34
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...