Use .dsn file for connecting

Label printing integration (NiceWatch middleware and ActiveX programming interface)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
Frederic
Enthusiast
Posts: 12
Joined: Wed Aug 13, 2014 11:17 am

Use .dsn file for connecting

Post by Frederic » Mon Sep 29, 2014 9:56 am

Hello,

my question is about possibilities to use a local .dsn file as a datasource.

Explanations: we want to print labels using data from a SQL server datasource. Nevertheless, we would like our architecture to be distributed, and to have several SQL server instance. Depending on the computer which is connecting to print, we would like it to connect on a different server.

The most convenient way would be to store the connection string to the server on a .dsn file stored locally on each computer, and to define in the nicelabel lbl file to use the informations in the DSN file to connect.

Is tere a way to do this?

The only solution I found is to use the .dsn file to initialize the connection string. But afterwards, the connection string is stored in the label, and the dsn file is no more necessary.

Our ideal solution would be that the DSN file would be read each time the label is used, to have a dynamic connection string depending on the user/computer which is connected.

Dennis Ehmig
Addict
Addict
Posts: 157
Joined: Fri Mar 28, 2014 2:10 pm

Re: Use .dsn file for connecting

Post by Dennis Ehmig » Tue Sep 30, 2014 11:03 am

The only way to connect dynamically to a database is with the help of scripting. Using the normal database connections this is sadly not possible.

Frederic
Enthusiast
Posts: 12
Joined: Wed Aug 13, 2014 11:17 am

Re: Use .dsn file for connecting

Post by Frederic » Tue Sep 30, 2014 2:59 pm

Hello,

ok, thanks for the answer.

Is there a way, via scripting in the label itself, to use in designer the normal way to declare a database, and to dynamically modify the connection string at runtime (ie when printing) ?

Dennis Ehmig
Addict
Addict
Posts: 157
Joined: Fri Mar 28, 2014 2:10 pm

Re: Use .dsn file for connecting

Post by Dennis Ehmig » Wed Oct 01, 2014 8:55 am

I don't think I've seen this done before and I highly doubt it is possible.

The ActiveX interface to the label can be called in a VBScript in the label, e.g.:

Code: Select all

if CInt(GetLabelState) > 0 then
   label.NewDatabase()
end if
But this will just call the new database GUI.

You can find detailed information to the interface in this pdf:
http://ftp.nicelabel.com/docs/manuals/p ... de-eng.pdf
Many properties of the database interface are read-only though, that's what leads me to believe creating a database connection in the label is not possible, just one in the code (Adodb for example).

Post Reply