' 先從指定的路徑中讀取檔案的文字來源,並利用StreamReader 來接
Dim oRead As StreamReader = New StreamReader(txtFilePath.Text, System.Text.Encoding.Default)
' 因為文字檔是ANSI格式->中文碼為兩碼 ,.net為unicode-每個字都是一碼
' 先轉為byte格式,取出ANSI格式之資料(中文字算兩碼)正確所在,再轉回unicode格式
Dim sendBytes As [Byte]() = System.Text.Encoding.Default.GetBytes(line)
Dim strValue As String = System.Text.Encoding.Default.GetChars(sendBytes, startPos, endPos - startPos) MyObject.GetType().GetField(myRow("tcm_column_name")).SetValue(MyObject, strValue)
全站熱搜