05-07-2009 01:14 AM
hi, guys
I'm tried to use ODBC API SQLConfigDataSource function to programmatically create a User DSN of MySQL 5.1. I spent almost the whole week to searching at NI web and internet, and tried couple of ways. and now I had knew how to create a User DSN of MS Access by SQLConfigDataSource, but I still cannot create a User DSN of MySQL 5.1. Please refer the JPG file in below. I guess it shoud be is syntax problem but I don't know what is the correct syntax. I tried over five ways and all of fail.
Please help and advice the right way to solve this question. I will very appreciate so much for your kind.
thanks
Patch
05-08-2009 01:40 AM
How it's possible to add ODBC source to windows resources?
But since it's an API of Microsoft, you can refer to MSDN, or see if the parameters are matched corresponding to the content you see in the Call Library Function Node.
05-08-2009 04:31 AM
hi, sonning
thank you very much for your reply and suggestion.
I had read the post and MSDN in internet couple times before. as I said I knew how to create a User DSN of MS Access, so those parameters should be matched.
I also knew somebody who use this API created successfully by use C or VB6.
So the syntax (refer to the attached jpg file) is refer from the guy, but still cannot works in LV. that's why I guess maybe is syntax problem.
thanks
Patch
05-08-2009 04:46 AM
What kind of O/S are you using? Windows XP x32 or x64? Vista?
What dll are you calling? odbccp32.dll?
05-08-2009 05:16 AM
05-08-2009 05:57 AM - edited 05-08-2009 06:01 AM
You make quite a bit of a mess out of that string.
First the keywords are usually 3 letter abbreviations. Each parameter needs to be 0 terminated. and the whole parameter array needs to be double zero terminated.You may say parameter array???? Yes the string is an array of zero terminated strings and the last string element is an empty string, meaning its zero termination follows directly the previous one. Quotes if at all need to be put around the parameters, not the entire string array.
So taking this all lets look at your strings.
1) would be mostly right, except that quotes are totally wrong. You should do "DSN=aa\0Server=blabla\0..............\0\0" (quotes only to show the actual string but they should not be included in the string constant). You took that string probably literally from a C or Basic source example and there the quotes are necessary to tell the compiler that it is a string constant, but they are not part of the string constant itself. Of course you should enable backslash codes for that string.
2) "Data Source Name" is not likely a valid keyword.
3) Basically the same as 1)
4) parameters are not 0 terminated
5) errors from 2) and 4)
Rolf Kalbermatter
05-11-2009 01:23 AM
thanks your reply
for bonbon
1. my OS is windows pro XP x32 SP3 and calling odbccp32.dll.
2. I tried \r or\n, but still not work.
for roflk
please open this file and check the number one string syntax whether like you said or not. if the string syntax the same you said and still not work.if not , could you please advice the correct string syntax.
thanks
patch
05-11-2009 01:31 AM
patchchen wrote:thanks your reply
for bonbon
1. my OS is windows pro XP x32 SP3 and calling odbccp32.dll.
2. I tried \r or\n, but still not work.
for roflk
please open this file and check the number one string syntax whether like you said or not. if the string syntax the same you said and still not work.if not , could you please advice the correct string syntax.
thanks
patch
I repeat: NO QUOTES!!!!!
They are only used in your C (and VB) examples to tell the compiler that it is a string constant but are not part of the string itself
Rolf Kalbermatter
05-11-2009 09:16 PM
hi, rolfk
thanks your reply
you said no quotes, is that mean deleted " " ?
if it's right, after tried still not work. if not could you please advice...^^
please open this file and check those string syntax. number one to number three change the character form to capitalization and add some parameters. number four and number five change UID to ID. and still not work.
thanks
patch
05-12-2009 02:43 AM
patchchen wrote:hi, rolfk
thanks your reply
you said no quotes, is that mean deleted " " ?
if it's right, after tried still not work. if not could you please advice...^^
please open this file and check those string syntax. number one to number three change the character form to capitalization and add some parameters. number four and number five change UID to ID. and still not work.
thanks
patch
I really wonder! Your name is blue indicating that you are an NI employee. Am I supporting NI here now????
Rolf Kalbermatter