| SqlHelperExecuteSqlCommand Method (String, String, IEnumerableString) |
Framework to automate tests using Selenium WebDriver
Method is used for execution SQL query (select) and reading each column from row.
Namespace:
Ocaramba.Helpers
Assembly:
Ocaramba (in Ocaramba.dll) Version: 3.3.1
Syntax Exceptions Exception | Condition |
---|
KeyNotFoundException | Exception when there is not given column in results from SQL query. |
Examples How to use it:
var connectionString = "User ID=sqluser;Password=sqluserpassword;server=servername;";
ICollection<string> column = new List<string>();
column.Add("NationalIDNumber");
column.Add("ContactID");
const string SqlQuery = "SELECT [NationalIDNumber] as " + column.ElementAt(0) + " , [ContactID] as " + column.ElementAt(1) + " from [AdventureWorks].[HumanResources].[Employee] where EmployeeID=1";
Dictionary<string, string> results = SqlHelper.ExecuteSqlCommand(command, GetConnectionString(server), column);
See Also