KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Advanced Logs: ODBC Insert with _'_ Char

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    KS-Soft Forum Index -> HostMonitor
View previous topic :: View next topic  
Author Message
user24



Joined: 11 Sep 2002
Posts: 2

PostPosted: Thu Sep 12, 2002 4:18 am    Post subject: Reply with quote

I use a SQL-Server-Table to write LOG-Messages.
The QUERY-String is "Insert into tbl_Hostmon_Log (Datetime, testname, status, reply, SimpleStatus) VALUES ('%DateTime%', '%TestName%', '%Status%', '%Reply%', '%SimpleStatus%')"

This works fine, but if there ist a _'_ in the Reply-Field of HM (in NT-Log-Test very often), the QUERY fails because the _'_ is for SQL a Text-Delimeter.
Is there any Workaround ?

[ This Message was edited by: user24 on 2002-09-12 04:19 ]

[ This Message was edited by: user24 on 2002-09-12 06:17 ]
Back to top
View user's profile Send private message
simonl



Joined: 03 Apr 2002
Posts: 49

PostPosted: Thu Sep 12, 2002 2:52 pm    Post subject: Reply with quote

Change data type char to varchar or nvarchar.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
user24



Joined: 11 Sep 2002
Posts: 2

PostPosted: Mon Sep 16, 2002 4:27 am    Post subject: Reply with quote

Thats not the Solution.
The Reply-Field of the SQL-Server-Table is already Text-Type.
The Problem is:
The QUERY-String is "Insert into tbl_Hostmon_Log (Datetime, testname, status, reply, SimpleStatus) VALUES ('%DateTime%', '%TestName%', '%Status%', '%Reply%', '%SimpleStatus%')"

The Macro of HM replaces the Field-Names with the Value.
If the Reply-Field contains "This is a 'Test' for me", then the QUERY-String looks like:
"Insert into tbl_Hostmon_Log (... VALUES ('...', '...', '...', 'This is a 'Test' for me', '...')".
The ' near "Test" produce the Error.
If HM can konvert ' to '', then i think it Works.

Help me please...
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12795
Location: USA

PostPosted: Mon Sep 16, 2002 8:58 pm    Post subject: Reply with quote

Please try the patch at http://www.ks-soft.net/download/hm327.zip
This version can replace any characters in "Reply" field to any other. Just add 2 lines in hostmon.ini file, section [Misc].
[Misc]
SubstituteFieldFrom= '
SubstituteFieldTo = "

BTW you can replace several characters. E.g. if you want to replace '1' to 'A', '2' to 'B', '3' to 'C', add follow lines:
SubstituteFieldFrom= 123
SubstituteFieldTo = ABC

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    KS-Soft Forum Index -> HostMonitor All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index