Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default Read unicode (Asian Languages) from Excel spreadsheet

Hi,

I guess it is a common problem when read some DBCS value from Excel
spreadsheet but got question marks.
Following are my code
-----------------------------------------------------------------------------------
<%
Session.CodePage=65001
response.charset="UTF-8"
%
<HTML
<HEAD
<META http-equiv="Content-Type" content="text/html; charset=utf-8"
</HEAD
<BODY
<%
'Create a connection
Set oConn = Server.CreateObject("ADODB.Connection")
strConn = "Driver={Microsoft Excel Driver (*.xls)}; " &_
"DBQ=<someXLS file;" 'How to can set codepage or characterset here?
oConn.Open strConn

strCmd = "SELECT * from `<some Name defined in Excel'"

'Create a recordset
Set oRS = Server.CreateObject("ADODB.Recordset")

oRS.Open strCmd, oConn

'Output conects of Excel
while not oRS.EOF
for each item in oRs.Fields
response.write item.Name & "==" & item.value & "<br"
Next
ORs.moveNext
Wend
set ORs= nothing
set oConn = nothing
%
</BODY
</HTML
-------------------------------------------------------------------------------------

For the cloumn that include some Asian languages like Chinese, Japanese and
Korean, will display question marks ??? at this page.

Is it any way we can set codepage or characterset in the connectionstring?

Regadrs,

Frank






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Read unicode (Asian Languages) from Excel spreadsheet

Frank,

have you tried with Jet provider iso ODBC?..
the Jet Driver has unicode support.

Your DSN/ODBC approach is not the best way to use Ado.
you should use ADO with Jet's OLEDB provider.

hmm.. even Jet is listed as deprecated these days :)

Data Access Technologies Roadmap
(http://msdn.microsoft.com/library/de...y/en-us/dnmdac
/html/data_mdacroadmap.asp) #see Obsolete


Note the font you're using should support the dbms characters..
Have you checked that you can write a hardcoded asian string?


Sub ReadXL()
Const cConXL = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Extended Properties='Excel 8.0';Data Source=%File%;"

Dim oCon As ADODB.Connection
Dim oRst As ADODB.Recordset

Dim sFile$
Dim sSQL$

sFile = "c:\test.xls"
sSQL = "Select * from [Sheet1$]"

'Connect to the workbook
Set oCon = New ADODB.Connection
oCon.CursorLocation = adUseClient
oCon.Open Replace(cConXL, "%File%", sFile)

Set oRst = New ADODB.Recordset
oRst.Open sSQL, oCon, adOpenForwardOnly, adLockReadOnly, adCmdText
Stop ' or do your stuff

If oRst.State 0 Then oRst.Close
If oCon.State 0 Then oCon.Close
Set oRst = Nothing
Set oCon = Nothing

End Sub




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Frank wrote :

Hi,

I guess it is a common problem when read some DBCS value from Excel
spreadsheet but got question marks.
Following are my code:
----------------------------------------------------------------------
------------- <%
Session.CodePage=65001
response.charset="UTF-8"
%
<HTML
<HEAD
<META http-equiv="Content-Type" content="text/html; charset=utf-8"
</HEAD
<BODY
<%
'Create a connection
Set oConn = Server.CreateObject("ADODB.Connection")
strConn = "Driver={Microsoft Excel Driver (*.xls)}; " &_
"DBQ=<someXLS file;" 'How to can set codepage or characterset here?
oConn.Open strConn

strCmd = "SELECT * from `<some Name defined in Excel'"

'Create a recordset
Set oRS = Server.CreateObject("ADODB.Recordset")

oRS.Open strCmd, oConn

'Output conects of Excel
while not oRS.EOF
for each item in oRs.Fields
response.write item.Name & "==" & item.value & "<br"
Next
ORs.moveNext
Wend
set ORs= nothing
set oConn = nothing
%
</BODY
</HTML
----------------------------------------------------------------------
---------------

For the cloumn that include some Asian languages like Chinese,
Japanese and Korean, will display question marks ??? at this page.

Is it any way we can set codepage or characterset in the
connectionstring?

Regadrs,

Frank

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Character Path Limit for Asian Characters Outlook User 2009 Excel Discussion (Misc queries) 0 May 8th 09 07:33 AM
Saving Spreadsheet to Unicode extra quotation marks [email protected] Excel Discussion (Misc queries) 0 January 26th 06 03:19 PM
Saving Spreadsheet to Unicode extra quotation marks [email protected] Excel Discussion (Misc queries) 0 January 26th 06 03:18 PM
How do you display Greek and Russian languages in excel? Mark Hayden Excel Discussion (Misc queries) 1 August 1st 05 08:06 AM
how to read excel spreadsheet into database (DB2) mairhtin o'feannag Excel Programming 1 May 31st 04 01:04 AM


All times are GMT +1. The time now is 01:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"