MS ODBC encoding issue

Sam Hu samhudotsamhu at gmail.com
Sun Jan 13 17:58:23 PST 2013


On Monday, 31 December 2012 at 11:01:17 UTC, Regan Heath wrote:
> On Mon, 24 Dec 2012 07:18:51 -0000, Sam Hu 
> <samhudotsamhu at gmail.com> wrote:
>
>> On Friday, 21 December 2012 at 15:20:39 UTC, Regan Heath wrote:
>>> On Wed, 19 Dec 2012 06:33:16 -0000, Sam Hu 
>>> <samhudotsamhu at gmail.com> wrote:
>>>
>>>> On Monday, 10 December 2012 at 14:43:08 UTC, Regan Heath 
>>>> wrote:
>>>>> >
>>>>> Ahh, of course.  Now I'm having linking issues :p
>>>>>
>>>>> I'm using VisualD and I've added odbc32.lib to the right 
>>>>> place, but some symbols are still missing - specifically 
>>>>> the W versions.  I've dumped the symbols in the DMC 
>>>>> odbc32.lib and it's missing those symbols.
>>>>>>
>>>>> R
>>>>
>>>> I have such extra lib files to link successfully but I don't 
>>>> find any way to upload here.Sorry.
>>>
>>> NP, I am up and running.  I can run the test app and see my 
>>> existing rows, plus insert new ones.  I got it working with a 
>>> connection string directly to an access database file on disk 
>>> without needing a DSN, not sure why you were having trouble 
>>> with that.
>>>
>>> So, what sort of data do I need to add, which will cause the 
>>> issues you were originally having :)
>>>
>>> R
>>
>> Really excited to hear that! As I said,field contains Chinese 
>> characters will produce error during read from and write back 
>> to database file;
>
> Can you save some of these characters in a text file, as UTF-8, 
> and zip that and upload/attach it here for me to try.  I want 
> to make sure I'm testing the exact same data as you are.
>
> I suspect the issue you're having is related to the encoding of 
> the strings.  D expects/uses UTF-8, but the database will be 
> configured with a specific locale/encoding for the columns in 
> question.
>
> So, can you export/describe your database table to me, columns, 
> and locales/encodings etc so I can compare them to mine.
>
>> and can't work out a DSNless connection function.
>>
>> Would be much appreciated if you would like to share your 
>> complete code here.
>
> At present I'm simply using your code, with only very minor 
> changes to the odbcutiltest.d file, like the connection string 
> for example:
>
> odbc.connect(r"Driver={Microsoft Access Driver (*.mdb, 
> *.accdb)};Dbq=C:\Development\D\src\odbcutiltest\test.accdb;");
>
> And the table name "artists" (IIRC) plus I have 3 columns, so..
>
>     write("Please enter artist ID:");
>     string id=chomp(readln);
>     write("Please enter artist Name:");
>     string name=chomp(readln);
>     write("Please enter artist Age:");
>     string age=chomp(readln);
>
>     string sql="insert into artists 
> values("~id~",'"~name~"',"~age~");";
>     int changed=odbc.executeNonQuery(sql);
>     writefln("%d row affected.",changed);
>
> R

I'm more than happy to upload the database file here,but I can't 
find how to.May I have your mail address?Appreciated for all the 
help!


More information about the Digitalmars-d-learn mailing list