problem in accessing unicode data

R

Ritu

Hello friends,
I need to read/access unicode data saved in text/csv file through ADO.Net but I'm not able toget success. Is there any support provided in ado.net to access unicode data ??
Anticipating a Quick reply...

thanks in advance
Ritu

___
Newsgroups brought to you courtesy of www.dotnetjohn.com
 
P

Patrice

You have generally and arguement that allows to specify how the text file is
encoded.

What is your current code ?

Ritu said:
Hello friends,
I need to read/access unicode data saved in text/csv file through ADO.Net
but I'm not able toget success. Is there any support provided in ado.net to
access unicode data ??
 
R

Ritu

Thanks Patrice for your quick response.
Can u please tell me that where we have to specify the
argumnet mentioning the encoding of file ?
My present code is as follows:-

Dim oConn As OleDb.OleDbConnection = New
OleDb.OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\;Extended
Properties=""text;HDR=Yes;FMT=Delimited""")
oConn.Open()
Dim OCommand As OleDbCommand = New OleDbCommand
Dim OAdaptor As OleDbDataAdapter = New OleDbDataAdapter
Dim ODataSet As DataSet = New DataSet
OCommand.Connection = oConn
OCommand.CommandText = "Select * from test1.txt"
OAdaptor.SelectCommand = OCommand
OAdaptor.Fill(ODataSet )

Here Test1.txt is unicode file.
Thanx
Ritu
 
P

Patrice

Ok, you are using the text isam driver to read the text file.

I dont't know but from
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcjetschema_ini_file.asp
it doesn't seem it supports other encoding than ANSI or OEM.
Do you have a byte order mark at the beginning of the file ?

If the text isam driver doesn't support unicode, you could convert the text
file from unicode to ansi before reading the converted file with the text
isam driver.

See :
http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconreadingtextfromfile.asp

You'll use an argument in the constructor of the stream reader to tell the
file is using Unicode and you'll tell for the stream writer it should use
ANSI. This way you'll have a file that the text isam driver can read
properly.

Patrice

"Ritu" <[email protected]> a écrit dans le message de
Thanks Patrice for your quick response.
Can u please tell me that where we have to specify the
argumnet mentioning the encoding of file ?
My present code is as follows:-

Dim oConn As OleDb.OleDbConnection = New
OleDb.OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\;Extended
Properties=""text;HDR=Yes;FMT=Delimited""")
oConn.Open()
Dim OCommand As OleDbCommand = New OleDbCommand
Dim OAdaptor As OleDbDataAdapter = New OleDbDataAdapter
Dim ODataSet As DataSet = New DataSet
OCommand.Connection = oConn
OCommand.CommandText = "Select * from test1.txt"
OAdaptor.SelectCommand = OCommand
OAdaptor.Fill(ODataSet )

Here Test1.txt is unicode file.
Thanx
Ritu
 
R

Ritu

Ya it seems from the article that only ANSI/OEM encoding
is supported by ISAM.
Is there any other way to get the required information
without converting unicode file into ANSI file? By the way
we have a byte order mark at the beginning of the file.
Actually what we need is to fire a SQL query to get the
selected data from the file.

Thanx
Ritu
 
P

Patrice

It would mean that you can't use the text isam (as it doesn't support
unicode).

Then you are left with reading yourself the file (no problem as .NET file IO
supports unicode) and populate a DataSet. You'll have first to check that
you can perform what you intend on the datatable (as you'll not be able to
run an arbitrary SQL query against it).

Patrice

"Ritu" <[email protected]> a écrit dans le message de
Ya it seems from the article that only ANSI/OEM encoding
is supported by ISAM.
Is there any other way to get the required information
without converting unicode file into ANSI file? By the way
we have a byte order mark at the beginning of the file.
Actually what we need is to fire a SQL query to get the
selected data from the file.

Thanx
Ritu
 
R

Ritu

Ya now It seems the only way to get my work done.
Anyways thanx a lot for the quick replies

Regards
Ritu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top