Forum Discussion
hi Alex, Thanks for the reply.
Currently I connected db using the below command but i need to get the query result.
Please let me know how to overcome this issue. Thanks
Error:
Field 'date' not found
Error location:
Line: 64 Column: 18.
--------------------------------------------------------------------------------------------------
function Main()
{
var Qry;
var fieldName = "date";
// Create a query
Qry = ADO.CreateADOQuery();
// Specify the connection string
Qry.ConnectionString = 'db connection;
// Specify the SQL expression
Qry.SQL =' select count(distinct store_id) from tb_name where date = "2021-02-16"';
// Execute the query
Qry.Open();
// Process results and insert data into the test log
Log.AppendFolder("Disbursement");
Qry.First();
//EOF _Returns true if the current record position is after the last record, otherwise
while (! Qry.EOF)
{
// result = (Qry.FieldByName(fieldName).Value);
Log.Message(Qry.FieldByName(fieldName).Value);
Qry.Next();
};
// Close the query
Qry.Close();
};
Hi,
> Field 'CLAIM_PAY_DATE' not found
I assume that:
-- This is the SQL been executed:
Qry.SQL =' select count(distinct STORE_CODE) from aud_campaign_claims where CLAIM_PAY_DATE = "2021-02-16"';
-- And this line of code throws the error:
Log.Message(Qry.FieldByName(fieldName).Value);
If the above is correct then this is correct behavior because the result of your query does not contain CLAIM_PAY_DATE field but a count of records with distinct value for the STORE_CODE field.
You need to check (using some MySQL or another tool or using the code) how this field is named in the returned recordset and use this name to get the value.
Related Content
- 6 years ago
- 13 years ago
- 2 years ago