You are both wrong with the
DataAdapter
.
Why do you think there is an overload with the
querystring
and the
connectionstring
?
public DataSet select_query(string query, string con_str)
{
try
{
using (SqlDataAdapter da = new SqlDataAdapter(query,con_str))
{
DataSet ds = new DataSet();
da.Fill(ds);
return ds;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return null;
}
}