SqlDataReader in C# Script
is it possible to implement the SqlDataReader in TestComplete? What I want to do is reading values from a DB recordset. This values I want to store in a variable, because in the next step I want to check if an assigned value is in one table and in the other. (consistency check).
For example:
function checkDB()
{
var SqlQuery;
SqlQuery = ADO["CreateADOQuery"]();
SqlQuery["ConnectionString"] = createConnectionString("xx", "xx\\xx", "xx", "xx", "xx");
SqlQuery["SQL"] = "SELECT ProductID, Price, Name FROM products WHERE Price = 10";
SqlQuery["Open"]();
//so NOW I want to try something like this:
SqlDataReader reader = SqlQuery["ExecuteReader"]();
reader[0], reader[1], reader[2];
reader["Close"]();
SqlQuery["Close"]();
}
function createConnectionString(provider, dataSource, initialCatalog, userId, password)
{
var connString = "";
connString = "Provider=" + provider + ";" +
"Data Source=" + dataSource + ";" +
"Initial Catalog=" + initialCatalog + ";" +
"User Id=" + userId + ";" +
"Password=" + password + ";"
return connString;
}
when I try to compile the program an error is shown on the line
>> SqlDataReader reader = SqlQuery["ExecuteReader"]();
it says a ";" is expected. But there is a ";" on the end of the line?! So I don´t know further what to do. Someone can help me please?
Thanks a lot!
Juls