Skip to content

Instantly share code, notes, and snippets.

@Regenhardt
Forked from butler1233/Mysql.vb
Last active September 17, 2018 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Regenhardt/04e5cd2c3d8d668f429139db06631886 to your computer and use it in GitHub Desktop.
Save Regenhardt/04e5cd2c3d8d668f429139db06631886 to your computer and use it in GitHub Desktop.
public void SelectData(string query)
{
MySqlConnection conn = new MySqlConnection(mysqlcs);
try
{
conn.Open();
MySqlCommand sqlquery = new MySqlCommand(query, conn)
{
CommandTimeout = 0
};
MySqlDataReader returneddata = sqlquery.ExecuteReader();
ArrayList returnme = new ArrayList();
int looper = 0;
while (returneddata.Read())
{
int fieldloop = 0;
ArrayList row = new ArrayList();
row.Clear();
while (fieldloop < returneddata.FieldCount)
{
row.Add(returneddata.Item(fieldloop));
fieldloop = fieldloop + 1;
}
returnme.Add(row);
}
return returnme;
}
catch (MySqlException ex)
{
return ex.Message;
}
finally
{
conn.Close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment