LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

RegSetValueEx to Create ODBC Entries

I am using CVI 5.0.1 and would like to create ODBC entries without using the ODBC manager in Administrative Tools.   I do not have access to the new CVI functions:

 

RegWriteString()

 

which would make it simple.  Any sample code using the SDK functions such as RegSetValueEx would be helpful.  I have written a sample program containing:

 

const char dname[] = "V2002ERR";
LONG kstat;
  
   
    kstat = RegSetValueEx(HKEY_USERS,"Software\\ODBC\\ODBC.INI\\ODBC Data Sources",0,REG_SZ,dname,8);

 

It returns a 0, which is ERROR_SUCCESS, but does not write the key value.  I am missing something somewhere.

 

Thanks in advance, David

 

 

 

 

0 Kudos
Message 1 of 3
(3,681 Views)

The instruction seems syntactically correct, but... which system are you running you app on? HKEY_USERS key does not contain a "Software" key, which can be found instead in HKEY_CURRENT_USER or HKEY_USERS\(userID) keys (at least on WinXP & Win7 systems).

 

Having said that, CVI5 is quite an old system that can have problems while running on systems from XP on



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,679 Views)

I'm running XP Pro.  I am moving all my applications to Win 7 this year.  Currently downloading the new CVI and if I can get that to create ODBC entries, then I will upgrade.  Time to upgrade anyway.

 

Is this functionality (ODBC create) in the new SQL Toolkit?

 

Thanks, Dave

 

0 Kudos
Message 3 of 3
(3,675 Views)