alarm loging to database


minhtham

Recommended Posts

Dear.

 

I won't to log alarm to a MS SQL sever 2012 with DAQ and I get the following error.Could you help me? I have seen some other posts but they refair to logging not alarm logging.

I have created a DNS System Data Sourse with windows authentication.

C1021 Could not create table for alarm logging.  Msg: Column, parameter, or variable #2: Cannot specify a column width on data type text.

I've created the table before opening DAQ

 

but when I opened it DAQ error still there"C1021 Could not create table for alarm logging.  Msg: Column, parameter, or variable #2: Cannot specify a column width on data type text."

I do not know what needs to add the DAQ declare it?

 

Untitledqqqqqq.jpg

Link to comment
Share on other sites

I can't say for sure, but hopefully this will help:

When DAQFactory logs, it does this first:

INSERT INTO ALARMLOG (TheTime, Name, Description, Priority, Status) VALUES (%.10f,'%s','%s',%d,'%s');

where the % stuff inside values is just placeholders for a printf() style command.  The key point is the field names.  If this fails, whether its because the table doesn't exist, or there is another error, it will assume the table doesn't exist and try and create it using:

CREATE TABLE ALARMLOG (TheTime DATE, Name TEXT(100), Description TEXT(255), Priority SHORT, Status TEXT(1));

My guess is that you don't want Text types for those columns, but instead want a VARCHAR.  Text is a blob format, where VARCHAR is actually a string format.  Try recreating your table using:

CREATE TABLE ALARMLOG (TheTime DATE, Name VARCHAR(100), Description VARCHAR(255), Priority INT, Status VARCHAR(1));

You might want DATETIME instead of DATE too.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.