04-08-2018 04:10 AM
I'm making some database functions using CVI SQL toolkit 2.3 (on Windows 7 & LW/CVI 2013)
The sample files (weather, flowchart......) are all working.
I tried to create my own mdb file, but the table and data are directed to samples.mdb of the sample files.
I specified the path in DBCreateTableFromMap, but not successful.
Please advise.
Solved! Go to Solution.
04-09-2018 12:53 PM
Hey Hong Kong,
A couple of questions and points:
Bdog
04-09-2018 09:29 PM
Hi,
We just want to make a custom database file. All functions are working (DBConnect, DBBeginMap, DBMapColumnToxxxx, DBCreateTableFromMap......).
The only questions is, the data is automatically saved to sample.mdb (the sample file of CVI SQL toolkit under the folder C:\......\CVI\Samples\sql), instead of our target file.
May be there are some settings in Windows ODBC but we have no idea.
Please advise.
04-10-2018 09:53 AM
Hi Hong_Kong,
Thanks for providing that context. The first step is to register your database. I copy and pasted the default 'samples.mdb' file into another location and renamed it:
Now, we have to register the database in the Microsoft ODBC manager. For this, in my Windows search I searched for 'ODBC Data Source Administrator' and opened 'ODBC Data Sources (32-bit)'. I then navigate to the 'System DSN' tab.
Here, we have our registered Data Source Names (DSN). The 'CVI SQL Samples' should look familiar because that's what CVI has been calling. To register our database, click on 'Add' and select the 'Microsoft Access Driver (*.mdb)' option:
Click 'Finish', and enter a Name and Description as shown below. The Name is how you will reference this DB in CVI and any other code.
Click 'Create' and enter a name for your custom .mdb file.
Click 'OK' and now you should see your database appear under the 'System Data Sources':
Now just connect to it from your code by replacing "CVI SQL Samples" with "Custom DB":
In your code specifically, you can replace the DB name in line 26 where you use CopyString().
Hope this helps,
Bdog
04-10-2018 11:53 PM
Hi Bdog,
Got it! Thank you so much.
A note for other users:
In Windows 7, the Administrative Tools shows only the 64-bit ODBC. The 32-bit ODBC is located here:
08-25-2023 04:52 PM - edited 08-25-2023 04:53 PM
Somebody reach the connection between SQL "No Access" and CVI, Currently i try to do the connection using SQL & CVI by ODBC?
08-25-2023 05:05 PM
Hello I try to connecto to SQL Using a ODBC driver on Labwindows cvi , but i get the following error, I declared the connection but it doesn't work. I was worked on the example that cvi provides. if i perform a data source test it works properly.
08-29-2023 02:11 AM
The error message seems pretty clear. The database requires a login but there is no login configured. Either configure it in the ODBC DSN (no recommended) or provide the correct username and password to the DB Connect() function call.