AndrejP

CITECT SCADA 6.1 + Microsoft SQL Express 2008

7 posts in this topic

Hello.

I'm trying to connect to Microsoft SQL Server (2008 EXPRESS), but the connection is not working.

I have done this in Citect SCADA 2018 without any problems using connection string:

hSQL = SQLConnect("SCADA Data Provider=SQLClient.....)

How can I connect to MS SQL Server using Citect 6.1?

Thanks.

Best regards.

Share this post


Link to post
Share on other sites

@AndrejP Maybe you should use ODBC connection ad use Cicode like this.

hSQL = SQLConnect("DSN=MyDatabase;UID=username;PWD=password");

 

1 person likes this

Share this post


Link to post
Share on other sites

Hello. 

Wasan Thanks for answer.

I helped myself with "Database Exchange Controll" to build connection string.

The result for successfull connection was (almost the same as yours):

hSQL = SQLConnect("DSN=SQLDatabase_Name;UID=UserName;PWD=Password;APP=CITECT;WSID=ComputerName;DATABASE=SQLDatabase_Name;")

Best regards, Andrej.

    
    

Share this post


Link to post
Share on other sites

I have tested this on Citect SCADA 2016. It DOES NOT WORK in this version...

Share this post


Link to post
Share on other sites

Is Citect 2016 SCADA are on same computer with Citect 2018 that you described before?

Share this post


Link to post
Share on other sites

Hello.

The Citect Nexa 6.1 is running on WIN7 machine.

The Citect 2016 is on different machine using WIN10

If you are using MSSQL-Wxpress, The connection string using CITECT 2016 is:

hSQL = SQLConnect("SCADA Data Provider=SQLClient;Persist Security Info=False;Integrated Security=true;Initial Catalog=mydatabase;User ID=User;Password=Password;server=PC_NAME\SQLEXPRESS;")


 

Share this post


Link to post
Share on other sites

But now I have another problem.

In Citect Nexa 6.1 I'm using conn string:

hSQL = SQLConnect(" Driver={SQL Server};Server=PC_NAME\SQLEXPRESS;Database=MyDatabase;Uid=User;Pwd=Password)

It connects without problems.

If I use Querystring: SELECT * FROM MyDataTable it works. I've got values from table.

BUT!!!

If I use more complicated Querys like Queriing a Subquery (IT WORKS IN SCADA 2016 and in SQL SERVER MANAGEMENT STUDIO):

SELECT *
from (
    SELECT * 
    from mytable
) subquery

I've got error: 4501Unexpected text at end of SQL query 'FROM'

Does someone have any advise?

Thanks.

Best regards.

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now