WinCC SQL Connection Using C Script

J

Thread Starter

JIT

I am using WinCC V5.1 and one of customer want me to write C script to connect to SQL server database of his inventory system. Can any one suggest me solution.

Thanx in advance.
 
R

Ronald Nijssen

There are two ways I know you can interface from a C script in WinCC to a Database supporting ODBC

1. Use the ODK functions that WinCC provides. There is a set of ODBC ODK functions that allows you to open the Database connection and perform actions
2. Use MSDAC (Microsoft Data Access Components), e.g. the RecordSet Object to do the same. A not very well known feature of WinCC scripts is its ability to use COM Objects. Since RecordSet is a COM object you can use it in a script as an interface to any ODBC Database

I will send you an example of the latter solution direct to your E mail address

(This shows that within Siemens there are people that know what you can do with WinCC)

Kind Regards
Ronald Nijssen
 
Hi
I have done quite a lot of work on connecting WinCC to various databases, including SQL Server, MSAccess, Oracle and Sybase.

If you go to "www.wincc.net":http://www.wincc.net you will find a WinCC application that demonstrates the basic scripting involved. There is also an FAQ entitled "Sample Script to Connect to SQL Server" which should be more than enough to get you started.

Please log on to the site using as
UserID: guest
Password: guest

If you have any further questions, I would be happy to answer them.

hope this helps
thanks,
Salma
 
M

Maguire, Kevin

What?
That's ridiculous.

1. The WinCC configuration manual has examples of C scripts and SQL statements for using within WinCC.
2. Anyone that knows SQL can write statements to read/write from the open sql database in WinCC to any other sql-compliant database. You will, of
course, need to understand the table layout of the inventory system.
3. Siemens tech support can answer your questions about this subject as it is almost as common as connecting to a PLC.
4. If you are in the US, contact me and I'll direct you to US tech support.

Sincerely,

Kevin C. Maguire
Regional Business Development Manager
Siemens Energy & Automation, USA
847-839-3224
 
There are two ways I know you can interface from a C script in WinCC to a Database supporting ODBC

1. Use the ODK functions that WinCC provides. There is a set of ODBC ODK functions that allows you to open the Database connection and perform actions
2. Use MSDAC (Microsoft Data Access Components), e.g. the RecordSet Object to do the same. A not very well known feature of WinCC scripts is its ability to use COM Objects. Since RecordSet is a COM object you can use it in a script as an interface to any ODBC Database

I will send you an example of the latter solution direct to your E mail address

(This shows that within Siemens there are people that know what you can do with WinCC)

Kind Regards
Ronald Nijssen



Dear Ronald would you mind sending the example to my email ?
 
Top