Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Datagrid not displaying

Reply
Thread Tools

Datagrid not displaying

 
 
Dave
Guest
Posts: n/a
 
      11-18-2004
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 [i] "
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


 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      11-18-2004
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" <(E-Mail Removed)> wrote in message
news:eLIx$(E-Mail Removed)...
> 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 [i] "
> 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
>
>



 
Reply With Quote
 
 
 
 
Dave
Guest
Posts: n/a
 
      11-18-2004
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:eLIx$(E-Mail Removed)...
> > 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 [i] "
> > 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
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Form DataGrid not displaying - please help me!!! almurph@altavista.com ASP .Net 3 06-29-2007 07:32 PM
Datagrid footer not displaying data .Net Sports ASP .Net 1 03-13-2006 07:54 PM
datagrid not displaying data table data .Net Sports ASP .Net 2 08-30-2005 11:16 PM
Datagrid problem not displaying anything on the screen!! =?Utf-8?B?UGF0cmljay5PLklnZQ==?= ASP .Net 1 09-30-2004 06:21 AM
DataGrid not displaying in new mode Mervin Williams ASP .Net 2 05-06-2004 04:58 PM



Advertisments