Announcement

Collapse
No announcement yet.

Error Writing to DB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ultrajones
    replied
    Originally posted by reidfo View Post
    Thank you, Ultra. Where did you post this? I don't see it. Or do you mean you sent it to the updater and it will take a couple days?
    Sorry, missed this question. I host my own plug-in downloads, so as soon as I post them they are available for download via the HomeSeer updater.

    Regards,
    Ultrajones

    Leave a comment:


  • mark_anderson_us
    replied
    Originally posted by Ultrajones View Post
    Wow, testing shows I don't need to escape those characters when doing an insert. The error "The statement has been terminated. String or binary data would be truncated" means the escape character is being ignored and treated as a normal string. I am removing it now and will post an update.

    Regards,
    Ultrajones
    The only one you should need to escape for an insert is single quote

    Leave a comment:


  • reidfo
    replied
    Originally posted by Ultrajones View Post
    Sorry for the delay. I had to install SQL Server 2008 Express to see what was going on. I was able to duplicate the issue. UltraLog HSPI version 1.2.4775.22583 just posted which should fix the issue reported.

    Regards,
    Ultrajones
    Thank you, Ultra. Where did you post this? I don't see it. Or do you mean you sent it to the updater and it will take a couple days?

    Leave a comment:


  • Ultrajones
    replied
    Sorry for the delay. I had to install SQL Server 2008 Express to see what was going on. I was able to duplicate the issue. UltraLog HSPI version 1.2.4775.22583 just posted which should fix the issue reported.

    Regards,
    Ultrajones

    Leave a comment:


  • Ultrajones
    replied
    Wow, testing shows I don't need to escape those characters when doing an insert. The error "The statement has been terminated. String or binary data would be truncated" means the escape character is being ignored and treated as a normal string. I am removing it now and will post an update.

    Regards,
    Ultrajones

    Leave a comment:


  • mark_anderson_us
    replied
    Originally posted by Ultrajones View Post
    Added it now... I wish I could find documentation showing what characters need to be escaped when using the Microsoft SQL database.

    Regards,
    Ultrajones
    Hi UltraJones

    I do a lot of MS SQL dev. I usually avoid these (mostly when using LIKE). Single quote is the main one for a regular query, but I have had issues concatenating strings when there is an ampersand in the string.

    percent sign (%)
    underscore (_)
    brackets ([ ])
    caret (^)
    hyphen (-)
    ampersand (&)
    single quote (')

    Regards

    mark

    Leave a comment:


  • Ultrajones
    replied
    Added it now... I wish I could find documentation showing what characters need to be escaped when using the Microsoft SQL database.

    Regards,
    Ultrajones

    Leave a comment:


  • reidfo
    replied
    Any updates on this? I saw in another thread you were planning to make the escape character configurable.

    Leave a comment:


  • reidfo
    replied
    Originally posted by Ultrajones View Post
    What database are you using?
    Using SQL 2008R2.

    Leave a comment:


  • Ultrajones
    replied
    Originally posted by reidfo View Post
    UJ, I'm also getting an insert error on devices using the % housecode. It was working with the version you had posted immediately prior to 1.2.4665.32287. I started getting the errors after updating to 1.2.4665.32287.

    Code:
    [COLOR=#D58000]InsertDeviceStatusIntoDB() Reports Error:  [System.Data.OleDb.OleDbException: The statement has been  terminated.String or binary data would be truncated.   at  System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior  behavior, String method)   at  System.Data.OleDb.OleDbCommand.ExecuteNonQuery()   at  HSPI_ULTRALOG.Database.InsertDeviceStatusIntoDB(DateTime ts, String hc,  String dc, Int32 status, Int32 data1, Int32 data2)], Failed on SQL:  INSERT INTO tblDeviceStatusLog (ts, hc, dc, status, data1, data2) VALUES  ('10/26/2012 11:00:14 AM','\%','\%49',17,790,0).
    [/COLOR]

    What database are you using?

    Leave a comment:


  • reidfo
    replied
    UJ, I'm also getting an insert error on devices using the % housecode. It was working with the version you had posted immediately prior to 1.2.4665.32287. I started getting the errors after updating to 1.2.4665.32287.

    Code:
    [COLOR=#D58000]InsertDeviceStatusIntoDB() Reports Error:  [System.Data.OleDb.OleDbException: The statement has been  terminated.String or binary data would be truncated.   at  System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior  behavior, String method)   at  System.Data.OleDb.OleDbCommand.ExecuteNonQuery()   at  HSPI_ULTRALOG.Database.InsertDeviceStatusIntoDB(DateTime ts, String hc,  String dc, Int32 status, Int32 data1, Int32 data2)], Failed on SQL:  INSERT INTO tblDeviceStatusLog (ts, hc, dc, status, data1, data2) VALUES  ('10/26/2012 11:00:14 AM','\%','\%49',17,790,0).
    [/COLOR]

    Leave a comment:


  • mark_anderson_us
    replied
    Originally posted by Ultrajones View Post
    Hello. I added an escape character to the % character. Can you try UltraLog HSPI version 1.2.4665.33287 I just uploaded to the HomeSeer updater?

    Regards,
    Ultrajones

    Thanks UJ.

    Will try tomorrow when back home

    Regards

    Mark

    Leave a comment:


  • Ultrajones
    replied
    Hello. I added an escape character to the % character. Can you try UltraLog HSPI version 1.2.4665.33287 I just uploaded to the HomeSeer updater?

    Regards,
    Ultrajones

    Leave a comment:


  • mark_anderson_us
    started a topic Error Writing to DB

    Error Writing to DB

    I have a few X10 devices that have house codes %1, etc.

    I get an error when they are triggered:

    10/9/2012 10:49:43 AM ~!~UltraLog Warning~!~InsertDeviceStatusIntoDB() Reports Error: [System.Data.OleDb.OleDbException: The statement has been terminated.String or binary data would be truncated. at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(Command Behavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at HSPI_ULTRALOG.Database.InsertDeviceStatusIntoDB(DateTime ts, String hc, String dc, Int32 status, Int32 data1, Int32 data2)], Failed on SQL: INSERT INTO tblDeviceStatusLog (ts, hc, dc, status, data1, data2) VALUES ('10/9/2012 10:49:43 AM','[%]','[%9]',3,2,0).

    I'm using SQL server for messages and % is a wildcrd. Could that be the issue? Anyone got any idea how to change house codes with X10/ACRF2 plug-in?

    Regards

    Mark
Working...
X