I'm implementing connection I implemented methods for Connect and Insert. Those methods are working. But I have problem how to implement getdata() method (get data from database). After I send query to the method and I need to know how to use SqlDataReader.
public String GetData(string _query)
{
try
{
SqlCommand cmd = new SqlCommand(_query, this.dbCon);
results = cmd.ExecuteReader().ToString();
return results;
}
catch (Exception)
{
return "Error";
}
}
I want to complete this get method, I'm using SQL Server and C#