![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]() |
![]() |
#1 |
Member
![]() ![]() Join Date: Feb 2023
Location: CE
Posts: 5
|
WinCC -> SQL real datatype
Hello all!
I have a problem with data logging from winCC to SQL server. I am trying to write a single variable type "Real" to SQL server. The problem is that SQL table doesn't show the decimal places. Data type of the variable in SQL database is also Real. "data1" is a HMI tag connected to a DB value of type Real in PLC. If I send value 5.0, only 5 is written into the database. VB script code: Sub VBFunction_2() Dim objConnection Dim strConnectionString Dim strSQL Dim objCommand Dim Data1 strConnectionString = "Provider=MSDASQL;DSN=TestODBC;UID=;PWD=;" Data1=SmartTags("data1") strSQL = "INSERT INTO TableReal (Number) VALUES ( " & Data1 & " );" Set objConnection = CreateObject ("ADODB.Connection") objConnection.ConnectionString = strConnectionString objConnection.Open Set objCommand = CreateObject("ADODB.Command") With objCommand .ActiveConnection = objConnection .CommandText = strSQL End With objCommand.Execute Set objCommand = Nothing objConnection.Close Set objConnection = Nothing End Sub Has anyone experienced similar issues? Thank you for helping ![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Connecting WinCC Flexible to SQL Server | Prince | LIVE PLC Questions And Answers | 1 | March 10th, 2015 03:31 PM |
WinCC Flexible 2008 SQL Database Stored Procedure | ryang112 | LIVE PLC Questions And Answers | 1 | March 10th, 2015 03:10 PM |
WinCC - Report Designer - SQL problem | Lesa | LIVE PLC Questions And Answers | 0 | April 4th, 2011 04:03 AM |
Strings WinCC -> S7-400 | Jeebs | LIVE PLC Questions And Answers | 2 | June 4th, 2010 10:43 AM |
WINCC - SQL instructions | Fritz_frederix | LIVE PLC Questions And Answers | 1 | May 5th, 2003 09:02 PM |