datagrid data not showing up

Discussion in 'ASP .Net' started by Brent Burkart, Jan 16, 2004.

  1. I have a datagrid that simply shows readonly data that i pull using sql.
    This was working fine and one day it stopped working.

    It shows the headers, but no data. Can anyone point me in the right
    direction? I am stuck.
    Brent Burkart, Jan 16, 2004
    #1
    1. Advertising

  2. Brent Burkart

    Curt_C [MVP] Guest

    run your SQL query in Query Analyser, test that first

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    www.Darkfalz.com


    "Brent Burkart" <> wrote in message
    news:eMYQ$...
    > I have a datagrid that simply shows readonly data that i pull using sql.
    > This was working fine and one day it stopped working.
    >
    > It shows the headers, but no data. Can anyone point me in the right
    > direction? I am stuck.
    >
    >
    Curt_C [MVP], Jan 16, 2004
    #2
    1. Advertising

  3. Brent Burkart

    Michael Guest

    Sure there is data in your datasource to be shown? Without posting any code
    it is going to be very hard to help you.

    "Brent Burkart" <> wrote in message
    news:eMYQ$...
    > I have a datagrid that simply shows readonly data that i pull using sql.
    > This was working fine and one day it stopped working.
    >
    > It shows the headers, but no data. Can anyone point me in the right
    > direction? I am stuck.
    >
    >
    Michael, Jan 16, 2004
    #3
  4. I have checked this and I have hooked up Profiler to see if my query is
    working. Not sure how to check for the data being returned. I assume it is
    since I am checking for present data in a Sqldatareader.

    Here is my code

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here


    get_data()

    Populate_Fields()

    End Sub

    Sub get_data()


    myConnection = New SqlConnection("x")

    myConnection.Open()

    myCommand = New SqlCommand("select
    BLASTNAME,BFIRSTNAME,BSOCSECNO,loan.LOANNUM,APPLTYPE,LOANSTAT,PROPADDR1 from
    borrower, propchar, loan where loan.loanid = borrower.loanid and loan.loanid
    = propchar.loanid and borrower.borrowercount = 1 and BSOCSECNO = '" &
    Trim(Request.QueryString("SSN")) & "'", myConnection)

    myDatareader = myCommand.ExecuteReader()

    End Sub

    Sub Populate_Fields()

    If myDatareader.Read Then

    myDataGrid.DataSource = myDatareader

    myDataGrid.DataBind()

    Else

    Label1.Text = "No data found corresponding to an SSN of " &
    Request.QueryString("ssn")

    End If

    myDatareader.Close()

    myConnection.Close()

    myDatareader = Nothing

    myConnection = Nothing

    myCommand = Nothing

    End Sub

    "Michael" <raterus@localhost> wrote in message
    news:%...
    > Sure there is data in your datasource to be shown? Without posting any

    code
    > it is going to be very hard to help you.
    >
    > "Brent Burkart" <> wrote in message
    > news:eMYQ$...
    > > I have a datagrid that simply shows readonly data that i pull using sql.
    > > This was working fine and one day it stopped working.
    > >
    > > It shows the headers, but no data. Can anyone point me in the right
    > > direction? I am stuck.
    > >
    > >

    >
    >
    Brent Burkart, Jan 16, 2004
    #4
  5. Yeah, the query works. I am not sure what else to check. I even ran it
    agains Profiler to make sure the query runs.

    Thanks
    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:%...
    > run your SQL query in Query Analyser, test that first
    >
    > --
    > Curt Christianson
    > Owner/Lead Developer, DF-Software
    > www.Darkfalz.com
    >
    >
    > "Brent Burkart" <> wrote in message
    > news:eMYQ$...
    > > I have a datagrid that simply shows readonly data that i pull using sql.
    > > This was working fine and one day it stopped working.
    > >
    > > It shows the headers, but no data. Can anyone point me in the right
    > > direction? I am stuck.
    > >
    > >

    >
    >
    Brent Burkart, Jan 16, 2004
    #5
  6. Brent Burkart

    Curt_C [MVP] Guest

    it runs, but does it have any data returned?

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    www.Darkfalz.com


    "Brent Burkart" <> wrote in message
    news:...
    > Yeah, the query works. I am not sure what else to check. I even ran it
    > agains Profiler to make sure the query runs.
    >
    > Thanks
    > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > news:%...
    > > run your SQL query in Query Analyser, test that first
    > >
    > > --
    > > Curt Christianson
    > > Owner/Lead Developer, DF-Software
    > > www.Darkfalz.com
    > >
    > >
    > > "Brent Burkart" <> wrote in message
    > > news:eMYQ$...
    > > > I have a datagrid that simply shows readonly data that i pull using

    sql.
    > > > This was working fine and one day it stopped working.
    > > >
    > > > It shows the headers, but no data. Can anyone point me in the right
    > > > direction? I am stuck.
    > > >
    > > >

    > >
    > >

    >
    >
    Curt_C [MVP], Jan 16, 2004
    #6
  7. yeah, I have taken the query that is generated and ran it in Query Analyzer.
    I pulls back data. I have posted my code in a post below.

    Thanks
    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:%233Wm0%...
    > it runs, but does it have any data returned?
    >
    > --
    > Curt Christianson
    > Owner/Lead Developer, DF-Software
    > www.Darkfalz.com
    >
    >
    > "Brent Burkart" <> wrote in message
    > news:...
    > > Yeah, the query works. I am not sure what else to check. I even ran it
    > > agains Profiler to make sure the query runs.
    > >
    > > Thanks
    > > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    > > news:%...
    > > > run your SQL query in Query Analyser, test that first
    > > >
    > > > --
    > > > Curt Christianson
    > > > Owner/Lead Developer, DF-Software
    > > > www.Darkfalz.com
    > > >
    > > >
    > > > "Brent Burkart" <> wrote in message
    > > > news:eMYQ$...
    > > > > I have a datagrid that simply shows readonly data that i pull using

    > sql.
    > > > > This was working fine and one day it stopped working.
    > > > >
    > > > > It shows the headers, but no data. Can anyone point me in the right
    > > > > direction? I am stuck.
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Brent Burkart, Jan 16, 2004
    #7
  8. I figured it out. In these cases there was only one record. When I checked
    to see if data exists
    If mydatareader.read
    I was eating up my first record. So when I bound the data, there was none
    left. I have to find another way to check for data.


    "Brent Burkart" <> wrote in message
    news:eMYQ$...
    > I have a datagrid that simply shows readonly data that i pull using sql.
    > This was working fine and one day it stopped working.
    >
    > It shows the headers, but no data. Can anyone point me in the right
    > direction? I am stuck.
    >
    >
    Brent Burkart, Jan 16, 2004
    #8
    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. tshad

    Datagrid not showing if no data

    tshad, Oct 10, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    4,023
    tshad
    Oct 11, 2005
  2. Ray Booysen
    Replies:
    2
    Views:
    634
    Ray Booysen
    Mar 28, 2006
  3. cms3023
    Replies:
    0
    Views:
    401
    cms3023
    May 20, 2007
  4. Brent Burkart

    datagrid data not showing

    Brent Burkart, Jan 16, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    8
    Views:
    135
    Brent Burkart
    Jan 23, 2004
  5. Guest
    Replies:
    0
    Views:
    106
    Guest
    Apr 12, 2006
Loading...

Share This Page