Skip to content

Instantly share code, notes, and snippets.

@butler1233
Created September 17, 2018 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save butler1233/0696979aaa068cd2b37a863b7f7a392e to your computer and use it in GitHub Desktop.
Save butler1233/0696979aaa068cd2b37a863b7f7a392e to your computer and use it in GitHub Desktop.
Public Function SelectData(query As String)
Dim conn As New MySqlConnection(mysqlcs)
Try
conn.Open()
Dim sqlquery As MySqlCommand = New MySqlCommand(query, conn) With {
.CommandTimeout = 0
}
Dim returneddata As MySqlDataReader = sqlquery.ExecuteReader()
Dim returnme As New ArrayList
Dim looper As Integer = 0
While returneddata.Read()
Dim fieldloop As Integer = 0
Dim row As New ArrayList
row.Clear()
While fieldloop < returneddata.FieldCount
row.Add(returneddata.Item(fieldloop))
fieldloop = fieldloop + 1
End While
returnme.Add(row)
End While
Return returnme
Catch ex As MySqlException
Return ex.Message
Finally
conn.Close()
End Try
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment