mike34 Posted May 19, 2015 Posted May 19, 2015 (edited) 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 EndIfthe 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 thanksmikethe content of column pictures looks like:U:\Bilder\Neumaschinen\P1080219.JPGU:\Bilder\P1080198.JPGU:\Bilder\P1080201.JPGU:\Bilder\30-TTR4400-II\P1080204.JPG Edited May 19, 2015 by mike34
Danp2 Posted May 19, 2015 Posted May 19, 2015 What is the value of $OptionVal after this line?$OptionVal = $sqlRS.Fields('PICTURES').ValueI would expect it to contain all of the unc paths. If so, you may be able to use StringSplit to get an array that you could then process one element at a time. Latest Webdriver UDF Release Webdriver Wiki FAQs
mike34 Posted May 21, 2015 Author Posted May 21, 2015 many thanks....$array = Stringsplit($getrimmt, chr(13) & chr(10), $STR_ENTIRESPLIT) was the answer :-)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now