CzaroK Posted February 25, 2009 Report Share Posted February 25, 2009 Hi. I'm working with the DB Connectivity Tools. I want to do exe-file from my VI, and I've got problem. I need add database file (MS Access file) to ODBC system source in LabView, and if it's possible create datalink in LV (without using Tools->Create Datalink). Somebody advices me to use the odbccp32.dll and the SQLConfigDataSource function, but it doesn't work. I put my VI in the attachment. Maybe somebody helps me ? Quote Link to comment
jcarmody Posted February 25, 2009 Report Share Posted February 25, 2009 Is there anything preventing you from using a connection string instead of a datalink? Quote Link to comment
Val Brown Posted February 25, 2009 Report Share Posted February 25, 2009 There are a number of examples available via the web for interconnecting to an Access mdb file using the DCT. I'm not where I have that list at this time but I would think a search on the NI forums or support link would work using keywords like "Access", "Database Connectivity", etc. Quote Link to comment
MikaelH Posted February 25, 2009 Report Share Posted February 25, 2009 I normally use a udl-file. (create a empty text file and rename it to something.udl , and then double click on it) My software reads this UDL/Text file and grabs the Provider string from it. E.g. Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Production;Data Source=MYSERVER The file is unicode and so you have to strip off all NULL-characters. If the file don't exists I start by creating it by just writing this Unicode-text file. Cheers, Mikael Quote Link to comment
crelf Posted February 25, 2009 Report Share Posted February 25, 2009 QUOTE (MikaelH @ Feb 24 2009, 04:37 PM) I normally use a udl-file. Here are some very basic UDL file VIs that might be useful (yes, I know that at least one dependancy is missing - get over it! ) Quote Link to comment
Rolf Kalbermatter Posted March 9, 2009 Report Share Posted March 9, 2009 QUOTE (CzaroK @ Feb 24 2009, 11:10 AM) Hi.I'm working with the DB Connectivity Tools. I want to do exe-file from my VI, and I've got problem. I need add database file (MS Access file) to ODBC system source in LabView, and if it's possible create datalink in LV (without using Tools->Create Datalink). Somebody advices me to use the odbccp32.dll and the SQLConfigDataSource function, but it doesn't work. I put my VI in the attachment. Maybe somebody helps me ? There are a few caveats with this for sure. First you can not add a System ODBC Data Source if you do not have administrator or at least power user rights. So I doubt this is what you want to do in a built executable. Also you can simply format the parameters that would otherwise be created with the ODBC Data Source Manager dialog into a string and pass that string to the Open Database function as connection string, instead of a name to an ODBC data source. To see what you would need to put in a string you can basically configure on your development machine such a datasource through the ODBC manager and then fgo into the registry and look at the keys in the section for your data source in HKEY_CURRENT_USER\Software\ODBC\ODBC.INI for user data sources and HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI for system data sources. You basically just put each value in there in a format <keyname>=<keyvalue> and separate each such expression with a semicolon and you should be fine. No need to create a Data Source and you can even format the actual path to your .mdb file no matter where you have it installed. Rolf Kalbermatter Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.