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

0
Avatar
Legacy Poster

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

http://seagullscientific.invisionzone.com/index.php?/topic/350-how-to-change-database-connection-string/

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.

Regards

Dav

2 意見

0
Avatar
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
http://support.microsoft.com/kb/165866

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?
blogs.technet.com/b/heyscriptingguy/archive/2004/11/10/can-i-create-and-delete-a-dsn-using-a-script.aspx

Hope that helps!
0
Avatar
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.

登入寫評論。