royd
8 years agoRegular Contributor
if else error - (SQL query)
I am getting an error when running flowing script:
var dbObj = ADO.CreateADOQuery(); dbObj.ConnectionString = "Provider=SQLOLEDB;Server=xxx.xx.xxx.xx;Database=THC_AppServices;User Id=user;Password=password"; dbObj.SQL = "SELECT [Group], [Key], DescLong FROM [System] WHERE [Group] = 'DirectedLogin' AND [Key] = 'ID"; queryResult = dbObj; dbObj.Open(); //log updated values dbObj.First(); while (! dbObj.EOF) { // Insert the field value into the test log Log.Checkpoint("Current " + "\'" + dbObj.FieldByName("Key").AsString + "\'" + " value for 'DescLong' is set to " + "\'" + dbObj.FieldByName("DescLong").AsString + "\'."); // Move to the next record dbObj.Next(); }dbObj.Close(); if (dbObj.FieldByName("DescLong").AsString === "id_DIRECTED_LOGIN_DISABLED") //line 27 { L_Activate_DL.activateDL(); } else { Log.Event("Driected Login already activated!"); }
The log: Current 'ID' value for 'DescLong' is set to 'id'. 11:18:41 Normal
The error:
Error location:
Unit: "SWCE9 Smoke Test \Script\A11020_Access_IP"
Line: 27 Column: 3.
I am new to JScript. Using TestComplete v12. No idea what am I doing wrong? Also, what does "Column: 3" mean, can someone explain please?
Thanks.
Dave
Hi Robert
Thank you for pointing that out. I seldom make these types of mistake, I would not be surprised at all. So, I double checked. It is fine for a change! :) I guess I messed up while pasting the code.
Thank you for the suggestion.