Dim _data As New DataGridView Dim MyDataTable As New DataTable Dim strQuery As String = Application.StartupPath & "\strquery.txt" If System.IO.File.Exists(strQuery) = True Then Dim objReader As New System.IO.StreamReader(strQuery) strQuery = objReader.ReadToEnd Else MsgBox("OR Sql Query file does not exists!", MsgBoxStyle.Information, "Security Information") Exit Sub End If Dim MySqlCommand As SqlCommand = New SqlCommand(strQuery) Call conn() MySqlCommand.CommandType = CommandType.Text MySqlCommand.Connection = MySqlConnection Dim MySqlDataAdapter As SqlDataAdapter = New SqlDataAdapter MySqlDataAdapter.SelectCommand = MySqlCommand Try MySqlConnection.Open() MySqlDataAdapter.SelectCommand = MySqlCommand MySqlDataAdapter.Fill(MyDataTable) _data.DataSource = MyDataTable Catch ex As Exception MessageBox.Show(ex.Message) Finally MySqlConnection.Close() MySqlConnection.Dispose() MySqlDataAdapter.Dispose() End Try
rowcount
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)