Datagrid not displaying

Discussion in 'ASP .Net Datagrid Control' started by Dave, Nov 18, 2004.

  1. Dave

    Dave Guest

    I'm tearing my hair out over this one. I have a newbie's grasp of data
    grids in vb.net, i.e. I have successfully taken working code, and made it
    work on my applications. I am unsuccessful at this one, however - I am
    trying to use a temporary table to load a grid. I do not get any errors
    running my code, I just don't get the data grid to appear on my web form.

    I'm using SQL Server 2000 and Visual Studio 2003. The query you see
    collects 499 records when I run it in Query Analyzer.

    Can somebody tell me if they see any obvious errors in my code - syntactic
    or conceptual? Thanks very much in advance.

    Dave

    Function MyFunction() as Boolean

    Dim sql As String = "SELECT Observation, Issue, Description "

    sql &= "INTO #tmpMultipleTableAggregate "
    sql &= "FROM tblLkpAssociatedIssues [L], tblIssueMaster "
    sql &= "WHERE L.Issue = i.IssueNumber "
    sql &= "ORDER BY Observation, L.Issue "

    Dim con As New SqlConnection(sConnect) 'sConnect is a global constant
    Dim cmd As New SqlCommand(sql, con)
    Dim adapter As New SqlDataAdapter(cmd)
    Dim dsIssueTracking As New DataSet

    con.Open()
    adapter.Fill(dsIssueTracking, "#tmpMultipleTableAggregate")
    con.Close()

    'Load the data grid with the temporary table culled from two other tables
    grdLink.DataSource = dsIssueTracking.Tables("#tmpMultipleTableAggregate")
    grdLink.Enabled = True
    grdLink.Visible = True

    grdLink.DataBind()

    End Function
     
    Dave, Nov 18, 2004
    #1
    1. Advertising

  2. Hey Dave, your query doesn't produce any record set! 499 records go to the
    temp table instead of getting down to your application.

    Get rid of "INTO #tmpMultipleTableAggregate " part. You don't need any temp
    tables. Data adapter will build a table named "Table" based on your SELECT
    results. Make a call
    adapter.Fill(dsIssueTracking)
    and databind the grid to table "Table".

    Eliyahu

    "Dave" <> wrote in message
    news:eLIx$...
    > I'm tearing my hair out over this one. I have a newbie's grasp of data
    > grids in vb.net, i.e. I have successfully taken working code, and made it
    > work on my applications. I am unsuccessful at this one, however - I am
    > trying to use a temporary table to load a grid. I do not get any errors
    > running my code, I just don't get the data grid to appear on my web form.
    >
    > I'm using SQL Server 2000 and Visual Studio 2003. The query you see
    > collects 499 records when I run it in Query Analyzer.
    >
    > Can somebody tell me if they see any obvious errors in my code - syntactic
    > or conceptual? Thanks very much in advance.
    >
    > Dave
    >
    > Function MyFunction() as Boolean
    >
    > Dim sql As String = "SELECT Observation, Issue, Description "
    >
    > sql &= "INTO #tmpMultipleTableAggregate "
    > sql &= "FROM tblLkpAssociatedIssues [L], tblIssueMaster "
    > sql &= "WHERE L.Issue = i.IssueNumber "
    > sql &= "ORDER BY Observation, L.Issue "
    >
    > Dim con As New SqlConnection(sConnect) 'sConnect is a global constant
    > Dim cmd As New SqlCommand(sql, con)
    > Dim adapter As New SqlDataAdapter(cmd)
    > Dim dsIssueTracking As New DataSet
    >
    > con.Open()
    > adapter.Fill(dsIssueTracking, "#tmpMultipleTableAggregate")
    > con.Close()
    >
    > 'Load the data grid with the temporary table culled from two other

    tables
    > grdLink.DataSource =

    dsIssueTracking.Tables("#tmpMultipleTableAggregate")
    > grdLink.Enabled = True
    > grdLink.Visible = True
    >
    > grdLink.DataBind()
    >
    > End Function
    >
    >
     
    Eliyahu Goldin, Nov 18, 2004
    #2
    1. Advertising

  3. Dave

    Dave Guest

    Re: Datagrid not displaying - SOLVED

    Wow! Nice explanation and nice solution. A one-minute fix - my favorite
    kind.

    For the benefit of my fellow newbies, when Eliyahu says
    "... and databind the grid to table 'Table'.", he means use this:
    grdLink.DataSource = dsIssueTracking.Tables("Table")

    Thank you very much, Eliyahu.

    Dave



    "Eliyahu Goldin" <> wrote in message
    news:%...
    > Hey Dave, your query doesn't produce any record set! 499 records go to the
    > temp table instead of getting down to your application.
    >
    > Get rid of "INTO #tmpMultipleTableAggregate " part. You don't need any

    temp
    > tables. Data adapter will build a table named "Table" based on your SELECT
    > results. Make a call
    > adapter.Fill(dsIssueTracking)
    > and databind the grid to table "Table".
    >
    > Eliyahu
    >
    > "Dave" <> wrote in message
    > news:eLIx$...
    > > I'm tearing my hair out over this one. I have a newbie's grasp of data
    > > grids in vb.net, i.e. I have successfully taken working code, and made

    it
    > > work on my applications. I am unsuccessful at this one, however - I am
    > > trying to use a temporary table to load a grid. I do not get any errors
    > > running my code, I just don't get the data grid to appear on my web

    form.
    > >
    > > I'm using SQL Server 2000 and Visual Studio 2003. The query you see
    > > collects 499 records when I run it in Query Analyzer.
    > >
    > > Can somebody tell me if they see any obvious errors in my code -

    syntactic
    > > or conceptual? Thanks very much in advance.
    > >
    > > Dave
    > >
    > > Function MyFunction() as Boolean
    > >
    > > Dim sql As String = "SELECT Observation, Issue, Description "
    > >
    > > sql &= "INTO #tmpMultipleTableAggregate "
    > > sql &= "FROM tblLkpAssociatedIssues [L], tblIssueMaster "
    > > sql &= "WHERE L.Issue = i.IssueNumber "
    > > sql &= "ORDER BY Observation, L.Issue "
    > >
    > > Dim con As New SqlConnection(sConnect) 'sConnect is a global constant
    > > Dim cmd As New SqlCommand(sql, con)
    > > Dim adapter As New SqlDataAdapter(cmd)
    > > Dim dsIssueTracking As New DataSet
    > >
    > > con.Open()
    > > adapter.Fill(dsIssueTracking, "#tmpMultipleTableAggregate")
    > > con.Close()
    > >
    > > 'Load the data grid with the temporary table culled from two other

    > tables
    > > grdLink.DataSource =

    > dsIssueTracking.Tables("#tmpMultipleTableAggregate")
    > > grdLink.Enabled = True
    > > grdLink.Visible = True
    > >
    > > grdLink.DataBind()
    > >
    > > End Function
    > >
    > >

    >
    >
     
    Dave, Nov 18, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mervin Williams

    DataGrid not displaying in new mode

    Mervin Williams, May 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    871
    Mervin Williams
    May 6, 2004
  2. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    Datagrid problem not displaying anything on the screen!!

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Sep 30, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    484
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=
    Sep 30, 2004
  3. .Net Sports

    datagrid not displaying data table data

    .Net Sports, Aug 30, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,811
    .Net Sports
    Aug 31, 2005
  4. .Net Sports

    Datagrid footer not displaying data

    .Net Sports, Mar 13, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    3,313
    Ignacio Machin \( .NET/ C# MVP \)
    Mar 13, 2006
  5. Replies:
    3
    Views:
    317
    Mark Rae
    Jun 29, 2007
Loading...

Share This Page