473,670 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Foxpro & Unicode

Hello !

I have a little problem accessing a Visual Foxpro-database using ODBC (Driver 6.00.8167)
(using System.Data.Odb c). Reading a column, defined in the Foxpro table definition as a kind
of binary char (i'm no foxpro-expert and the database is predetermined) and containing
Unicode-String, delivers a byte[] structure in the resulting DataSet. Showing
this column in a Datagrid only results in displaying "byte[]" instead of a value.

Now my questions:
1) Is this only a driver problem? Do i have to use another driver? OleDB?
2) In other cases: Is it possible to convert it automatically? Or do i have to
read every row, check for affected columns, convert them manually into
strings (using the Encoding-Class) and write it back to another datastructure?
(that would surely slow down performance *sigh*)
3) any other advices/hints ?

Maybe someone has faced this problem before?

Thanks in advance and greets !
Sascha

Nov 16 '05 #1
7 7322
Sascha,

I would try the oledb provider for FoxPro, as I believe it is geared for
later versions, which have better support for unicode strings/characters.

Can you attach the DBF or DBC file so that we could try it?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Sascha Schmidt" <Sa****@nospam. de> wrote in message
news:cv******** **@mail.lachman n-rink.de...
Hello !

I have a little problem accessing a Visual Foxpro-database using ODBC
(Driver 6.00.8167)
(using System.Data.Odb c). Reading a column, defined in the Foxpro table
definition as a kind
of binary char (i'm no foxpro-expert and the database is predetermined) and
containing
Unicode-String, delivers a byte[] structure in the resulting DataSet.
Showing
this column in a Datagrid only results in displaying "byte[]" instead of a
value.

Now my questions:
1) Is this only a driver problem? Do i have to use another driver? OleDB?
2) In other cases: Is it possible to convert it automatically? Or do i have
to
read every row, check for affected columns, convert them manually into
strings (using the Encoding-Class) and write it back to another
datastructure?
(that would surely slow down performance *sigh*)
3) any other advices/hints ?

Maybe someone has faced this problem before?

Thanks in advance and greets !
Sascha
Nov 16 '05 #2
Just to add, the latest FoxPro and Visual FoxPro OLE DB data provider is
downloadable from http://msdn.microsoft.com/vfoxpro/downloads/updates/ . It
will work with all versions of FoxPro tables and DBC's.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
ci************* *@msn.com www.cindywinegarden.com
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:uh******** ******@TK2MSFTN GP14.phx.gbl...
Sascha,

I would try the oledb provider for FoxPro, as I believe it is geared
for later versions, which have better support for unicode
strings/characters.

Nov 16 '05 #3
Hello again!

Using the suggested OleDb-Drivers (Microsoft OLE DB Provider for Visual
FoxPro 9.0)
and OleDb (using System.Data.Ole Db) did not solve the problem, the DataGrid
still
displays "Byte[] Array" and cannot be edited)
I used this connectionstrin g:
"Provider=VFPOL EDB.1;Data Source=C:\MyDB\ bgdb.DBC;Passwo rd=;Collating
Sequence=MACHIN E"
Can you attach the DBF or DBC file so that we could try it?

Sure, but i think it's not possible to add it to my newsgrouppostin g.
Maybe i can send it to an email address? (The zip-file's size is about 109
kB,
quite small).

Greets
Sascha

Nov 16 '05 #4
Hi Sascha,

You can send it (code sample, and all relevant data) to me and I'll play
with it.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
ci************* *@msn.com www.cindywinegarden.com
"Sascha Schmidt" <Sa****@nospam. de> wrote in message
news:cv******** **@mail.lachman n-rink.de...
Maybe i can send it to an email address? (The zip-file's size is about 109
kB,
quite small).

Nov 16 '05 #5
Hi Sascha,

Sorry I took so long to look at what you sent me offline.

The affected fields in your table are Visual FoxPro data type "Character
(Binary)" with field widths varying from 64 to 144. Character (Binary) field
types were in use in VFP6; the ODBC driver does not support data features
added after VFP6. Of course the OLE DB data provider is preferred. The field
names are McName, LotName, SpiMerge, Remarks, LabelName, Twist, PoyID, and
PoyDoff. Here's what the VFP9 Help says about Character (Binary) field
types:
Visual FoxPro Field Types
Character (Binary): Any Character data that you do not want translated
across code pages. For example, user passwords stored in a table and used in
different countries or regions.
<<

Here's something I found in a Google search:

Matt Campbell Apr 12 1999, 12:00 am:
"Fellow developers,
I recently posted a question asking if anyone knew how to convert "Character
(binary)" type data selected back from a VFP database into something
readable by VB. After I tried a lot of things ....Msoft Support came up with
an answer. You have to add two single quote chars and a "+" before the name
of the field holding the "Character (binary)" type data in the SQL query, as
in:

' These are 2 single quotes---V
rs.Open "Select usr_lanid, ''+usr_password as usr_password FROM users",
cnMain, adOpenStatic, adLockReadOnly

where the field usr_password is of the "Character (binary)" data type. The
data returned as usr_password will be readable by VB string-reading
functions.

Why this would work, I don't know. I will take an educated guess that by
adding ''+ to the field, you are signaling the OLE DB driver that the field
is of "Character (binary)" type and to cast is at a string.
<<

It's getting late here, so I haven't actually tried this yet.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
ci************* *@msn.com www.cindywinegarden.com
Nov 16 '05 #6
Hi Cindy,
using this workaround changes the situation a little bit, the first letter
of the string is
displayed.

I decided to use a kind of "brute-force-implementation" , building a new
DataTable, set
the column data type from byte[] to string, afterwards copying every row,
converting
(--> Encode) relevant cells.

Another solution might be to use DataGridTextBox Column::Format, but it seems
you
have to do some things manually and need code here also, maybe more than for
my
brute-force-implementation.

In this case i only need to read the table. I've heard that there are still
much problems
writing back a datatable into Foxpro via OleDbCommandBui lder and
OleDataAdapter ?

Thankful greets
Sascha

"Cindy Winegarden" <ci************ **@msn.com> schrieb im Newsbeitrag
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi Sascha,

Sorry I took so long to look at what you sent me offline.

The affected fields in your table are Visual FoxPro data type "Character
(Binary)" with field widths varying from 64 to 144. Character (Binary) field types were in use in VFP6; the ODBC driver does not support data features
added after VFP6. Of course the OLE DB data provider is preferred. The field names are McName, LotName, SpiMerge, Remarks, LabelName, Twist, PoyID, and
PoyDoff. Here's what the VFP9 Help says about Character (Binary) field
types:
Visual FoxPro Field Types
Character (Binary): Any Character data that you do not want translated
across code pages. For example, user passwords stored in a table and used in different countries or regions.
<<

Here's something I found in a Google search:
Matt Campbell Apr 12 1999, 12:00 am:
"Fellow developers,
I recently posted a question asking if anyone knew how to convert

"Character (binary)" type data selected back from a VFP database into something
readable by VB. After I tried a lot of things ....Msoft Support came up with an answer. You have to add two single quote chars and a "+" before the name of the field holding the "Character (binary)" type data in the SQL query, as in:

' These are 2 single quotes---V
rs.Open "Select usr_lanid, ''+usr_password as usr_password FROM users",
cnMain, adOpenStatic, adLockReadOnly

where the field usr_password is of the "Character (binary)" data type. The
data returned as usr_password will be readable by VB string-reading
functions.

Why this would work, I don't know. I will take an educated guess that by
adding ''+ to the field, you are signaling the OLE DB driver that the field is of "Character (binary)" type and to cast is at a string.
<<

It's getting late here, so I haven't actually tried this yet.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
ci************* *@msn.com www.cindywinegarden.com

Nov 16 '05 #7
Hi Sascha,

I've worked with it some and it's done everything I wanted to do, but then
again I've never worked with some of the less used data types like the Char
Binary that's in your table.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
ci************* *@msn.com www.cindywinegarden.com
"Sascha Schmidt" <Sa****@nospam. de> wrote in message
news:cv******** **@mail.lachman n-rink.de...
...I've heard that there are still
much problems
writing back a datatable into Foxpro via OleDbCommandBui lder and
OleDataAdapter ?

Nov 16 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1301
by: Gandhi | last post by:
Hi all, I've noticed that using xmlrpc_encode() (php built-in function) changes the encoding of data (to unicode, it seems). Is there a way to prevent this, so that xmlrpc_encode doesn't alter the data? Any help appriciated.
23
2118
by: Michel Claveau - abstraction méta-galactique non | last post by:
Hi ! If Python is Ok with Unicode, why the next script not run ? # -*- coding: utf-8 -*- def режим(toto): return(toto*3)
3
1377
by: anthony hornby | last post by:
Hi, I am starting my honours degree project and part of it is going to be manipulating ASCII encoded XML files from a legacy database and converting them to Unicode and doing text processing stuff on the data. I am new to python ( total n00b ) but am keen to use it as the rest of the software my application has to extend is already written in python, plus I've always wanted to learn more about it - so here's my chance :-) I've written...
27
5139
by: EU citizen | last post by:
Do web pages have to be created in unicode in order to use UTF-8 encoding? If so, can anyone name a free application which I can use under Windows 98 to create web pages?
0
2420
by: Marcel Jalbert | last post by:
Hartford Connecticut area Fortune 500 Financial Services Company is looking for several experienced FoxPro and Visual Basic DotNet programmers. 10 Years FoxPro and 3 Years VB DotNet experience desired. These are temporary consulting positions to end upon completion of a project to rewrite our legacy application in VB DotNet. Compensation is dependent on experience. Knowledge of Unit Investment Trusts and mutual fund trading, pricing and...
0
1308
by: Pavel aka crazy | last post by:
hi, all! how can i use unicode in postgresql tables? "createdb -E UNICODE dbname" work correctly, but when i put data and then read it i see only garbage instead cyrillic letters. what i do wrong? -- FreeLSD Best regards, Pavel aka crazy Linux Registered User #303117
3
2146
by: KvS | last post by:
Hi all, I've been reading about unicode in general and using it in Python in particular lately as this turns out to be not so straightforward actually. I wanted to aks two questions: 1) I'm writing a program that interacts with the user through wxPython (unicode build) and stores & retrieves data using PySQLite. As fas as I know now, both packages are capable of handling Python unicode objects (wxPython returns the values of text...
0
8466
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8901
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8659
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7412
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6212
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4388
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2799
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1791
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.