I try to use following code from example
hhttp://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/general/access-sql-database.aspx
But compilation error occurs:
for this statement
What I did wrong? Or is there the error?
hhttp://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/general/access-sql-database.aspx
SqlConnection thisConnection = new SqlConnection("Data Source=.\\sqlexpress; Initial Catalog=myFirstDB; Integrated Security=true;"); //We define a new SQL connection with a connection string. //The connection string will be different depending on your usecase and the name of the Database, table etc. //If you don't know how to write a connection string please look for tutorials on the Internet thisConnection.Open(); Log.WriteLine(thisConnection.Database); //Wrie the name of the database to the Log SqlCommand thisCommand = thisConnection.CreateCommand(); //Create an SQL command thisCommand.CommandText = "SELECT test FROM MyFirstTable"; //This is a simple SQL command that will go through all the values in the "test" column from table "MyFirstTable" //The SQL command will vary depending on your usecase. //If you don't know how to write SQL commands please look for tutorials on the Internet SqlDataReader thisReader = thisCommand.ExecuteReader(); //Create SQL reader while (thisReader.Read()) { //Loop to go through the entire column //Write each value to the log //You can implement you own custom logic here Log.WriteLine("Value of test column:" + thisReader("test")); } thisReader.Close(); //Close Reader thisConnection.Close(); //Close connection to SQL database'thisReader' is a 'variable' but is used like a 'method'Log.WriteLine("Value of test column:" + thisReader("test"));