RE: Excel 2000, ADO and Unicode

From: Mikko Lahti (MikkoL@onyx.com)
Date: Thu Jul 27 2000 - 19:48:56 EDT


:) I wasn't using the JET provider, that was the problem. All works now.
Thanks!

Later,

Mikko
Globalization Specialist
Onyx Software - Bringing e-business and business together
MikkoL@onyx.com
www.onyx.com
425.519.4172

-----Original Message-----
From: Michael (michka) Kaplan [mailto:michka@trigeminal.com]
Sent: Thursday, July 27, 2000 4:38 PM
To: Mikko Lahti; i18n-prog@acoin.com; unicode@unicode.org
Subject: Re: Excel 2000, ADO and Unicode

So you do not think I am nuts here. :-)

Set con = New ADODB.Connection
set rs = New ADODB.Recordset
con.Provider = "Microsoft.JET.OLEDB.4.0"
stCon = "Excel 5.0;DATABASE=book1.xls;HDR=NO;IMEX=2"
con.ConnectionString = stCon
con.Open
stSql = "SELECT * FROM [Sheet1$]"
rs.Open stSql, con, adOpenStatic, adLockReadOnly

The spreadsheet had the following in Sheet1: ر.س.‏ 5,678.90

When I looked at Hex(AscW(rs(0))) I got back 0631 (Arabic Letter Reh) as
expected.

Definitely, the Unicode data in the spreadsheet was preserved.

michka

----- Original Message -----
From: "Michael (michka) Kaplan" <michka@trigeminal.com>
To: "Mikko Lahti" <MikkoL@onyx.com>; <i18n-prog@acoin.com>;
<unicode@unicode.org>
Sent: Thursday, July 27, 2000 4:05 PM
Subject: Re: Excel 2000, ADO and Unicode

> Ok, I guess I am not sure what exactly you are trying to do here.
>
> You are using the Jet OLE DB IISAM that does Excel?
>
> michka
>
>
> ----- Original Message -----
> From: "Mikko Lahti" <MikkoL@onyx.com>
> To: "Michael (michka) Kaplan" <michka@trigeminal.com>;
> <i18n-prog@acoin.com>; <unicode@unicode.org>
> Sent: Thursday, July 27, 2000 3:57 PM
> Subject: RE: Excel 2000, ADO and Unicode
>
>
> > I tried OLE DB as well but results are same. Data type returned is
> > adVarChar. Any other ideas?
> >
> > Later,
> >
> > Mikko
> > Globalization Specialist
> > Onyx Software - Bringing e-business and business together
> > MikkoL@onyx.com
> > www.onyx.com
> > 425.519.4172
> >
> > -----Original Message-----
> > From: Michael (michka) Kaplan [mailto:michka@trigeminal.com]
> > Sent: Thursday, July 27, 2000 2:46 PM
> > To: Mikko Lahti; i18n-prog@acoin.com
> > Subject: Re: Excel 2000, ADO and Unicode
> >
> > Try not using the ODBC driver. use the OLE DB driver, you will be much
> > happier with teh Unicode persistence.
> >
> > michka
> >
> >
> > ----- Original Message -----
> > From: "Mikko Lahti" <MikkoL@onyx.com>
> > To: <i18n-prog@acoin.com>
> > Sent: Thursday, July 27, 2000 2:37 PM
> > Subject: Excel 2000, ADO and Unicode
> >
> >
> > > I'm running into a problem when I try to query Unicode data from
> Microsoft
> > > Excel using the Excel ODBC driver via ADO/VB.
> > >
> > > My queries work fine w/ ANSI data but not for multilingual (Unicode)
> data.
> > > I'm just getting ??? back so somebody does not support Unicode.
> > >
> > > When I looked at
> http://msdn.microsoft.com/library/psdk/dasdk/odbc8h4j.htm
> > > <http://msdn.microsoft.com/library/psdk/dasdk/odbc8h4j.htm> , if I'm
> > reading
> > > it correctly, Excel data type TEXT is mapping to SQL VARCHAR and not
> > > NVARCHAR, which would be a problem in this case.
> > >
> > > Is this the case or am I don't something wrong? Is there a workaround
> for
> > > this (other than not to use Excel)?
> > >
> > > Later,
> > >
> > > Mikko
> > > Globalization Specialist
> > > Onyx Software - Bringing e-business and business together
> > > MikkoL@onyx.com
> > > www.onyx.com
> > > 425.519.4172
> > >
> > >
> > > Here is the VB code:
> > >
> > > Dim adoConnection As ADODB.Connection
> > > Dim adoRecordset As ADODB.Recordset
> > > Dim sConnectionString As String
> > > Dim sQuery As String
> > >
> > > 'Instantiate the connection and recordset objects
> > > Set adoConnection = New ADODB.Connection
> > > Set adoRecordset = New ADODB.Recordset
> > >
> > > 'Create the connection string
> > > sConnectionString = "Driver={Microsoft Excel Driver
> > > (*.xls)};DBQ=e:\temp\test.xls;DriverID=790"
> > >
> > > 'Create the query string
> > > sQuery = "select data from ""Sheet1$"" where id = 2"
> > >
> > > 'Open the connection
> > > adoConnection.Open sConnectionString
> > > 'Get the recordset
> > > adoRecordset.Open sQuery, adoConnection, adOpenStatic,
> adLockReadOnly
> > >
> > >
> > >
> >
> > /* the i18n-prog homepage is at: */
> > /* http://www.acoin.com/i18n/i18n-prog.htm */
> > /* See the page for removal instructions, etc. */
> >
>
> /* the i18n-prog homepage is at: */
> /* http://www.acoin.com/i18n/i18n-prog.htm */
> /* See the page for removal instructions, etc. */
>
>



This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:21:06 EDT