Expand|Select|Wrap|Line Numbers
- public class MyClass
- {
- SqlConnection ConnectionSql = null;
- SqlCommand CommandSql = null;
- SqlDataReader QueryResult = null;
- public MyClass(string dbString)
- {
- ConnectionSql = new SqlConnection(dbString);
- CommandSql = ConnectionSql.CreateCommand();
- CommandSql.Connection = ConnectionSql;
- }
- public string ReturnSomething(string sql, int colIndex)
- {
- ConnectionSql.Open();
- CommandSql.CommandText = sql;
- CommandSql.Connection = ConnectionSql;
- QueryResult = CommandSql.ExecuteReader();
- return (QueryResult[colIndex].ToString());
- }
- }