Hi,
We have a Navision 4.0 SP3 Database with over 40 companies.
We need to extract data from this database using the ODBC Connector. I'm using a c# script, and have created a odbc data source and using code:
OdbcConnection DbConnection = new OdbcConnection("DSN=nav_database");
try
{
DbConnection.Open();
..... etc etc...
Can I add something to the connection string so that I can choose de company from code? It's a total ](*,) having to create over 40 datasources in the ODBC administrator.
Thanks!
0
Comments
The other option is to use cfront
3rd option is to integrate using NAS
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
The ODBC DSN info is stored in the registry and is easily accessible. Knowing that, here are a few creative options:
Mark's idea about the registry update from c# worked for me.
I create the ODBC connection using any company. Then from C# I query the "Company" Table, and for each line, I update the registry key HKLM/software/ODBC/ODBC.ini/NavisionDataSource/CompanyName and read all the data I need from each.
This site helped:
http://www.mojobudgie.com/a-very-simple ... try-value/
:thumbsup: