Click or drag to resize

SqlHelperExecuteSqlCommand Method (String, String, String)

Framework to automate tests using Selenium WebDriver
Method is used for execution SQL query (select) and reading each row from column.

Namespace:  Ocaramba.Helpers
Assembly:  Ocaramba (in Ocaramba.dll) Version: 3.3.1
Syntax
C#
public static ICollection<string> ExecuteSqlCommand(
	string command,
	string connectionString,
	string column
)

Parameters

command
Type: SystemString
SQL query.
connectionString
Type: SystemString
Server, user, pass.
column
Type: SystemString
Name of column.

Return Value

Type: ICollectionString
Collection of each row existed in column.
Examples
How to use it:
var connectionString = "User ID=sqluser;Password=sqluserpassword;server=servername;";
const string ColumnName = "AccountNumber";
const string SqlQuery = "SELECT  AccountNumber as " + ColumnName + " FROM [AdventureWorks].[Sales].[Customer] where [CustomerID] in (1, 2)";
var result = SqlHelper.ExecuteSqlCommand(SqlQuery, connectionString, ColumnName);
See Also