smuehlfeld
May 4th, 2001, 08:54 AM
Hello,
I try to insert unicode-data into an oracle-database.
If I insert the data into a textbox, and write it then into the database, it is no problem.
But now I want to read the data from a textfile with the following code :
Open File_Path For Input As #1
Do Until EOF(1)
Line Input #1, Row_Content
Row_Content = Trim(Row_Content)
length = Len(Row_Content)
Pos_Nr = InStr(Row_Content, ";")
FirstName = Trim(Left(Row_Content, Pos_Nr - 1))
If IsUnicode(FirstName) = True Then
FirstName = StrConv(FirstName, vbFromUnicode)
End If
Row_Content = Trim(Right(Row_Content, length - Pos_Nr))
length = Len(Row_Content)
Pos_Nr = InStr(Row_Content, ";")
SurName = Trim(Left(Row_Content, Pos_Nr - 1))
If IsUnicode(SurName) = True Then
SurName = StrConv(SurName, FromUnicode)
End If
Row_Content = Trim(Right(Row_Content, length - Pos_Nr))
year = Val(Row_Content)
Unicode_Tab2.AddNew
Unicode_Tab2!FirstName = FirstName
Unicode_Tab2!SurName = SurName
Unicode_Tab2!year = year
Unicode_Tab2.Update
Loop
Close #1
The code of the function IsUnicode is :
Private Function IsUnicode(s As String) As Boolean
If Len(s) = LenB(s) Then
IsUnicode = False
Else
IsUnicode = True
End If
End Function
But it doesn't function, because the Result of the function IsUnicode is ever TRUE. And so all strings are convert as unicode.
Now the problem ist, that I must decide, if a string contents only ASCII-characters or not.
Please help me,
Sascha
I try to insert unicode-data into an oracle-database.
If I insert the data into a textbox, and write it then into the database, it is no problem.
But now I want to read the data from a textfile with the following code :
Open File_Path For Input As #1
Do Until EOF(1)
Line Input #1, Row_Content
Row_Content = Trim(Row_Content)
length = Len(Row_Content)
Pos_Nr = InStr(Row_Content, ";")
FirstName = Trim(Left(Row_Content, Pos_Nr - 1))
If IsUnicode(FirstName) = True Then
FirstName = StrConv(FirstName, vbFromUnicode)
End If
Row_Content = Trim(Right(Row_Content, length - Pos_Nr))
length = Len(Row_Content)
Pos_Nr = InStr(Row_Content, ";")
SurName = Trim(Left(Row_Content, Pos_Nr - 1))
If IsUnicode(SurName) = True Then
SurName = StrConv(SurName, FromUnicode)
End If
Row_Content = Trim(Right(Row_Content, length - Pos_Nr))
year = Val(Row_Content)
Unicode_Tab2.AddNew
Unicode_Tab2!FirstName = FirstName
Unicode_Tab2!SurName = SurName
Unicode_Tab2!year = year
Unicode_Tab2.Update
Loop
Close #1
The code of the function IsUnicode is :
Private Function IsUnicode(s As String) As Boolean
If Len(s) = LenB(s) Then
IsUnicode = False
Else
IsUnicode = True
End If
End Function
But it doesn't function, because the Result of the function IsUnicode is ever TRUE. And so all strings are convert as unicode.
Now the problem ist, that I must decide, if a string contents only ASCII-characters or not.
Please help me,
Sascha