Click here to Skip to main content
11,570,352 members (42,953 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB.NET
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 20:03pm
Edited 21-Sep-12 11:25am
(no name)136.7K
Kenneth Haugland at 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 at 21-Sep-12 17:29pm
Any errors? Does your query return any results?
Ervin Pacibe at 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 at 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

Advertise | Privacy | Mobile
Web03 | 2.8.150624.2 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2015
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