Hi,
Why you do not execute a general Query like
SELECT X, Y, GroupName FROM [dbo].Coordinates]
, after that, split the query according the GroupName:
while (reader.Read())
{
string currentGroupName = reader["GroupName"].ToString();
switch (currentGroupName)
{
case "Alpha":
AlphaX = reader["X"].ToString();
AlphaY = reader["Y"].ToString();
break;
case "Beta":
BetaX = reader["X"].ToString();
BetaY = reader["Y"].ToString();
break;
}
}
In this case you only execute one query and you could close the connection faster than querying the DB twice.
Hope this helps.
Best regards and have a nice day,
Stops