Bartender Version 9.3 - Change Database Connection String On The Labels In C# 追蹤

Legacy Poster

I can see another thread for 9.4 but that thread is not complete and verified.

Can somebody list the steps and code to accomplish this for 9.30. I want to change connection string for dev, TEST and PROD
environment while printing the label.



2 意見

Shotaro Ito
評論操作 永久連結

Hi Dav,
Unfortunately BarTender doesn't support switching OLEDB/ODBC database programably.
What you can change is user name and password to connect.

One alternative is, use ODBC connection.
Since ODBC connection is defined by Windows (not in BarTender format),
you can modify ODBC datasource to switch database to connect.
ODBC datasource can be created by ODBC administrator of Management tools.

You can create File DSN and modify the file programablly

XL: How to Use File DSNs and DSN-less Connections

Or - you can play with registry to create / modify System / User DSN. (risky way, I'd say)

Can I Create and Delete a DSN Using a Script?

Hope that helps!
Legacy Poster
評論操作 永久連結

Hi dav,

On my case, is not a solution store on any resource the connection string to my production database and/or production data. To fix this "lack of functionality" i did:
- Modify my .btw file to use a .txt file as a datasource.
- Modify my app to get data from my database (my application can change the datasource from developer to production enviroment by configuration! :o )
- On my application, create and fill this txt file with the data and put it on a temp folder (The .btw file references it)
- After send to print the data, my app deletes the txt file and everyones happy, no production data is stored on operation pcs.

I hope this could help you.