Click here to Skip to main content
13,301,100 members (81,963 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Here is my Code...
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
            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
            MySqlDataAdapter.SelectCommand = MySqlCommand
            _data.DataSource = MyDataTable

        Catch ex As Exception
        End Try

When I checked the rowcount of _data the value is 0.

Please help me.
Posted 20-Sep-12 21:03pm
Kenneth Haugland 21-Sep-12 17:29pm
Are the MyDataTable filled with objects? And Id like to see you query string as well... And whats hidden in conn?
Wes Aday 21-Sep-12 17:29pm
Any errors? Does your query return any results?
Ervin Pacibe 23-Sep-12 23:22pm
i dont have error.. the query is correct because i have a datagridview in the form to make sure the query is correct..but i dont need the datagridview in form.. i need to pass the data of MyDataTable in _Data.
Ervin Pacibe 23-Sep-12 23:27pm
@kenneth Huagland the sub conn is the sql connection..

btw thx for reply guys

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171207.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100