隨筆 - 6  文章 - 129  trackbacks - 0
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(14)

          隨筆檔案(6)

          文章分類(467)

          文章檔案(423)

          相冊

          收藏夾(18)

          JAVA

          搜索

          •  

          積分與排名

          • 積分 - 827218
          • 排名 - 49

          最新評論

          閱讀排行榜

          評論排行榜

          轉自:http://hi.baidu.com/zydpc/blog/item/3268273eb8e80ce055e72338.html
          描述

          Inserts data into a DataWindow control, DataStore object, or graph control from data in a file.一個文件插入數據到一個數據窗口控件,數據存儲對象,圖形或數據控制。 The data can be tab-separated text, comma-separated text, XML, or dBase format 2 or 3.這些數據可以制表符分隔的文本,以逗號分隔的文本,XML或dBASE格式2或3。 The format of the file depends on whether the target is a DataWindow (or DataStore) or a graph and on the type of graph.該文件的格式取決于該目標是一個數據窗口(或數據存儲)或圖和圖型。

          For DataWindow and DataStore syntax, see the ImportFile method for DataWindows in the DataWindow Reference or the online Help .對于數據窗口和DataStore的語法,請參閱聯機幫助 ImportFile 的方法,在數據窗口DataWindows參考或

          Applies to適用于

          Graph controls in windows and user objects.圖控制在窗口和用戶對象。 Does not apply to graphs within DataWindow objects, because their data comes directly from the DataWindow.不適用于在數據窗口對象的圖形,因為它們的數據直接來自數據窗口。

          Syntax句法

          graphname . ImportFile (  { importtype}, filename {, startrow {, endrow {, startcolumn } } } ) graphname。ImportFile((importtype),(文件名,startrow(,endrow(,startcolumn))))

          Argument論據

          Description描述

          graphname graphname

          The name of the graph control to which you want to copy data from the specified file.該控件的名稱圖,您要復制文件數據從指定的。

          importtype (optional) importtype(可選)

          An enumerated value of the SaveAsType DataWindow constant.一個數據窗口不斷枚舉值的SaveAsType。 If this argument is specified, the importtype argument can be specified without an extension.如果該參數指定,importtype參數可以指定不帶擴展名。 Valid type arguments for ImportFile are:論點ImportFile有效的類型有:

          • Text!文字!

          • CSV! CSV格式!

          • XML! XML的!

          • DBase2! DBase2!

          • DBase3! DBase3!

           

          filename 文件名

          A string whose value is the name of the file from which you want to copy data.一個字符串,其值是文件名從你要復制的數據。 The file must be an ASCII, tab-separated file (TXT), comma-separated file (CSV), Extensible ), or dBase format 2 or 3 file (DBF).該文件必須是一個ASCII,制表符分隔的文件(TXT),逗號分隔文件(CSV),可擴展),或2或3的dBase格式文件(DBF的)。 Specify the file's full name.指定文件的全名。 If the optional importtype is not specified, the name must end in the appropriate extension.如果沒有指定可選的importtype,名稱必須結束在適當延長。

          If you do not specify filename or if it is null , ImportFile prompts the user for a file name.如果你不指定文件名 ,或者如果它為null,ImportFile提示文件的名稱為一個用戶。 The remaining arguments are ignored.剩余的參數將被忽略。

          startrow (optional) startrow(可選)

          The number of the first detail row in the file that you want to copy.該文件要拷貝數的第一行中的細節。 The default is 1.默認是1。

          For default XML import, if startrow is supplied, the first N ( startrow -1) elements are skipped, where N is the DataWindow row size.對于默認XML導入,如果startrow提供, 一個N(startrow -1)的元素都被跳過, 其中 N是數據窗口行的大小。

          For template XML import, if startrow is supplied, the first對于XML導入模板,如果startrow提供,首 ( startrow -1) occurrences of the repetitive row mapping defined in the template are skipped. (startrow -1)發生了重復的行映射模板中定義跳過。

          endrow (optional) endrow(可選)

          The number of the last detail row in the file that you want to copy.該文件要拷貝數的最后細節行中。 The default is the rest of the rows.默認的是該行的其余部分。

          For default XML import, if endrow is supplied, import stops when N * endrow elements have been imported, where N is the DataWindow row size.對于默認XML導入,如果endrow提供,進口停止 N * endrow內容已經進口的, 其中 N是數據窗口行的大小。

          For template XML import, if endrow is supplied, import stops after endrow occurrences of the repetitive row mapping defined in the template have been imported.對于XML導入模板,如果endrow提供,該模板中定義導入后停止endrow行中出現的重復測繪已導入。

          startcolumn (optional) startcolumn(可選)

          The number of the first column in the file that you want to copy.匱乏的拷貝數列的第一個文件中的你。 The default is 1.默認是1。

          For default XML import, if startcolumn is supplied, import skips the first ( startcolumn - 1) elements in each row.對于默認XML導入,如果startcolumn提供,進口跳過第一(startcolumn - 1)在每個行元素。

          This argument has no effect on template XML import.這一論點并沒有對模板的效果XML導入。

          Returns返回

          Long.長。 Returns the number of rows that were imported if it succeeds and one of the following negative integers if an error occurs:返回發生錯誤的行的數目進口,如果成功,它下面的一個負整數,如果一:

          • -1 No rows or startrow value supplied is greater than the number of rows in the file -1沒有行或startrow值是文件大于供給的數量的行

          • -2 Empty file or input data does not match number of columns or required column type -2文件為空或輸入的數據類型不匹配的列數或要求列

          • -3 Invalid argument -3無效參數

          • -4 Invalid input -4輸入無效

          • -5 Could not open the file -5無法打開文件

          • -6 Could not close the file -6無法關閉文件

          • -7 Error reading the text -7錯誤閱讀文本

          • -8 Unsupported file name suffix (must be *.txt, *.csv, *.dbf or *.xml) -8不支持的文件名后綴(必須是*. txt文件,*. CSV格式,*. dbf或*. xml的)

          • -10 Unsupported dBase file format (not version 2 or 3) -10不受支持的dBASE文件格式(而不是版本2或3)

          • -11 XML Parsing Error; XML parser libraries not found or XML not well formed -11 XML解析錯誤; XML解析器庫不存在或沒有很好形成的XML

          • -12 XML Template does not exist or does not match the DataWindow -12 XML模板不存在或不匹配的數據窗口

           

          If any argument's value is null , ImportFile returns null . If the optional importtype argument is specified and is not a valid type, ImportFile returns -3.如果任何參數的值 null, 返回 null ImportFile。如果可選importtype參數指定,而不是一個有效的類型,ImportFile返回-3。

          Usage用法

          The format of the file can be indicated by specifying the optional importtype parameter, or by including the appropriate file extension.該文件的格式,可通過指定可選的顯示importtype參數,或通過包括適當的文件擴展名。

          For graph controls, ImportFile only uses three columns and ignores other columns.對于圖形控制,ImportFile只使用3列,而忽略其他列。 Each row of data must contain three pieces of information.每個數據行中必須包含三個信息件。 The information depends on the type of graph:該信息取決于圖表類型:

          • For all graph types except scatter, the first column to be imported is the series name, the second column contains the category, and the third column contains the data.對于所有類型,除了散布圖,第一列從外地輸入的是該系列的名稱,第二列包含類,第三列包含的數據。

          • For scatter graphs, the first column to be imported is the series name, the second column is the data's x value, and the third column is the y value.對于散布圖,第一列從外地輸入的是該系列的名稱,第二列是數據的x值,第三列是y值。

           

          You can add data to more than one series by specifying different series names in the first column.您可以添加數據到多個系列的第一列指定不同的系列名稱研究。 To let users select the file to import, specify a null string for filename . PowerBuilder displays the Select Import File dialog box.為了讓用戶選擇要導入的文件, 文件名指定一個字符串。PowerBuilder中顯示選擇導入文件對話框。

          Double quotes The location and number of double quote marks in a field in a tab delimited file affect how they are handled when the file is imported. 雙引號雙數場引號中的位置和一個制表符分隔的文件影響到他們如何處理時,該文件是進口的。 If a string is enclosed in one pair of double quotes, the quotes are discarded.如果字符串被雙引號括在一對的報價將被丟棄。 If it is enclosed in three pairs of double quotes, one pair is retained when the string is imported.如果是雙引號括在三對,一對是保留字符串時是進口的。 If the string is enclosed in two pairs of double quotes, the first pair is considered to enclose a null string, and the rest of the string is discarded.如果字符串引號括在雙兩對,第一對被認為是一個空字符串括起來,而其余的字符串將被丟棄。

          When there is a double quote at the beginning of a string, any characters after the second double quote are discarded.當有一個雙引號的字符串開始時,雙引號的所有字符后,第二次將被丟棄。 If there is no second double quote, the tab character delimiting the fields is not recognized as a field separator and all characters up to the next occurrence of a double quote, including a carriage return, are considered to be part of the string.如果沒有第二個引號,制表符分隔的返回字段是不承認所有作為字段分隔符和字組成的一個運輸的下一個出現的一個雙引號,包括被認為是字符串的一部分。 A validation error is generated if the combined strings exceed the length of the first string.驗證錯誤,如果合并生成字符串的字符串長度超過了第一。

          Double quotes after the first character in the string are rendered literally.雙引號字符的字符串字面呈現后的第一次。 Here are some examples of how tab-delimited strings are imported into a two-column DataWindow:這里有一些例子,說明制表符分隔的字符串被導入到一個兩列的數據窗口:

          Text in file文本文件

          Result結果

          "Joe" TAB "Donaldson" “喬”統計表“唐納森”

          Joe Donaldson喬唐納森

          Bernice TAB """Ramakrishnan"""伯尼斯統計表“”“萊瑪克里斯南”“”

          Bernice "Ramakrishnan"伯尼斯“萊瑪克里斯南”

          ""Mary"" TAB ""Li"" “”瑪麗“”標簽“,”禮“”

          Empty cells空細胞

          "Mich"ael TAB """Lopes""" “邁克”機場快線統計表“”“洛佩斯”“”

          Mich "Lopes"邁克“洛佩斯”

          "Amy TAB Doherty" “艾米統計表多爾蒂”

          Amy<TAB>Doherty in first cell, second cell empty艾米<Tab>鍵多爾蒂在第一個單元格,第二個單元格為空

          3""" TAB 4" 3“”“標簽4”

          3""" 4" 3“”“4”

          注意 Specifying a null string for file name If you specify a null string for filename , the remaining arguments are ignored. 指定一個文件名稱為字符串 ,如果你指定一個字符串為文件名 ,其余的參數被忽略。 All the rows and columns in the file are imported.文件的所有行和列的都是進口的。

          Examples范例

          Example 1 示例1

          This statement copies all the data in the file D:\EMPLOYEE.TXT to gr_employee starting at the first row:本聲明中的所有數據復制的文件D:\ EMPLOYEE.TXTgr_employee行開始在第一:

          gr_employee. ImportFile ("D:\EMPLOYEE.TXT") gr_employee。ImportFile(的“D:\ EMPLOYEE.TXT”)

           

          Example 2 例2

          This statement copies the data from the file D:\EMPLOYEE.TXT starting with row 2 column 3 and ending with row 30 column 5 to the graph gr_employee :本聲明的副本文件 D中的數據來自:\ EMPLOYEE.TXT開始,第2行第3列和行結尾的5至30列圖gr_employee:

          gr_employee. ImportFile ("D:\EMPLOYEE.TXT", 2, 30, 3) gr_employee。ImportFile(的“D:\ EMPLOYEE.TXT”,2,30,3)

           

          Example 3 例3

          The following statements are equivalent.下面的語句是等價的。 Both import the contents of the XML file named myxmldata :這兩種導入XML文件的內容命名myxmldata:

          gr_control.ImportFile(myxmldata.xml) gr_control.ImportFile(myxmldata.xml)
                      gr_control.ImportFile(XML!, myxmldata) gr_control.ImportFile(XML的!,myxmldata)

           

          Example 4 范例4

          This example causes PowerBuilder to display the Specify Import File dialog box:這個例子使PowerBuilder中顯示指定文件導入對話框:

          string null_str字符串null_str

           

          SetNull(null_str) SetNull(null_str)

           

          dw_main. ImportFile (null_str) dw_main。ImportFile(null_str)


          posted on 2010-06-01 22:47 Ke 閱讀(8650) 評論(0)  編輯  收藏 所屬分類: powerBuilder
          主站蜘蛛池模板: 鄯善县| 灵寿县| 乌拉特中旗| 滨州市| 穆棱市| 深泽县| 怀来县| 恩平市| 府谷县| 遵化市| 房产| 屏边| 平安县| 保山市| 府谷县| 永州市| 鹤壁市| 方正县| 汉沽区| 桐梓县| 平度市| 磴口县| 疏勒县| 中牟县| 收藏| 淮南市| 古蔺县| 青海省| 邢台市| 大足县| 巴林右旗| 万州区| 景谷| 锡林郭勒盟| 达拉特旗| 赣州市| 社旗县| 池州市| 海宁市| 浦江县| 武陟县|