Results 1 to 5 of 5

Thread: [RESOLVED] [2008] SQL return correct values - GridView column is blank

  1. #1

    Thread Starter
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Resolved [RESOLVED] [2008] SQL return correct values - GridView column is blank

    I've just started using ASP.NET again after a long layoff. I wasn't any good back then and now I'm worse. This is also my first work with Oracle 9i. Long story short:

    GetSellOffDates SQL in TableAdapter
    Code:
    select
      to_date(custd.FIELD_VALUE, 'dd-mon-yyyy'),
      ag.AGREEMENTS_ABBR,
      ag.AGREEMENTS_NAME,
      ag.CONTRACTSTATUS_NAME,
      ag.CONTRACT_CODE,
      ag.SITE_CODE,
      custd.INTERNAL_DESCRIPTIONS_CODE,
      custd.DESCRIPTIONS_NAME
    from V_REPCUSTOMFIELDDATA custd
      right join V_AGREEMENT ag
        on custd.ASSOCIATED_WITH_INTERNAL_KEY = ag.CONTRACT_CODE
    where 
      custd.INTERNAL_DESCRIPTIONS_CODE = 35
      and ag.AGREEMENTS_ABBR like upper(:licensorNum)
      and custd.FIELD_VALUE between 
        to_date(:sellOffStart, 'mm/dd/yyyy') and to_date(:sellOffEnd, 'mm/dd/yyyy')
    order by
      custd.FIELD_VALUE,
      ag.AGREEMENTS_ABBR
    Building and filling the GridView:
    vb.net Code:
    1. ' Blank column
    2. Dim sellOff As New BoundField()
    3. sellOff.HeaderText = "Sell Off Date"
    4. sellOff.DataField = "FIELD_VALUE"
    5. Me.GridView1.Columns.Add(sellOff)
    6.  
    7. ' This one is fine as are all others.
    8. Dim licensorNum As New BoundField()
    9. licensorNum.HeaderText = "Licensor Number"
    10. licensorNum.DataField = "AGREEMENTS_ABBR"
    11. Me.GridView1.Columns.Add(licensorNum)
    12.  
    13. <snip>
    14.  
    15. Dim ta As New MMDataSetTableAdapters.V_REPCUSTOMFIELDDATATableAdapter
    16. Dim dt As Data.DataTable = ta.GetSellOffDates("%" & Me.licensorNum.Text & "%", Me.sellOffStart.Text, Me.sellOffEnd.Text)
    17.  
    18. Me.GridView1.DataSource = dt
    19. Me.GridView1.DataBind()

    Everything works just fine, except for the fact that the "Sell Off Date" column in my GridView is blank. Every cell in this column is empty. However, the results appear to be returned correctly - i.e. I get the right number of rows based upon the values of my Parameters, the Order By clause orders the rows correctly and all the columns are populated EXCEPT for the "Sell Off Date" column. Does that make sense?

    I'm sure I'm missing some easy, probably in the formatting of the column, but I've been staring at it a long time to no avail. Any help is appreciated.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2008] SQL return correct values - GridView column is blank

    I see this

    Code:
    sellOff.DataField = "FIELD_VALUE"
    So when you run that SQL against Oracle, does the result have a FIELD_VALUE returned against it? I don't think it's entirely obvious, because in your SQL, I do see

    Code:
    to_date(custd.FIELD_VALUE, 'dd-mon-yyyy'),
    but that has no alias against it.

  3. #3

    Thread Starter
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: [2008] SQL return correct values - GridView column is blank

    Well, that was easy. I have the alias in my SQL that I've been running directly against the database in SQL*Plus. I'm not sure why I didn't include it in my TableAdapter.

    P.S. 11 minutes for a response that answers my question? I thought you said we could expect fast answers in the ASP.NET forum. Phhhh. Slacker.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2008] SQL return correct values - GridView column is blank

    Well, in those 11 minutes, I also had to save Superman, help an old lady cross a street, solve a border crisis in central Africa and wonder why my potatoes aren't cooked yet.

    But the main point is, you got your answer (you should be using stored procedures btw, to avoid these bad scenarios), my potatoes are almost done, and it still took less time than Oracle would take to run a simple SELECT statement.

  5. #5

    Thread Starter
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Re: [RESOLVED] [2008] SQL return correct values - GridView column is blank

    Mmmmmmmmmmmmm....Potatoes. Well, I guess that was a well spent 11 minutes then.

    On the note of stored procedures, I can only select from this database. Meh.

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width