|
-
Apr 15th, 2008, 03:20 PM
#1
Thread Starter
Registered User
[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:
' Blank column
Dim sellOff As New BoundField()
sellOff.HeaderText = "Sell Off Date"
sellOff.DataField = "FIELD_VALUE"
Me.GridView1.Columns.Add(sellOff)
' This one is fine as are all others.
Dim licensorNum As New BoundField()
licensorNum.HeaderText = "Licensor Number"
licensorNum.DataField = "AGREEMENTS_ABBR"
Me.GridView1.Columns.Add(licensorNum)
<snip>
Dim ta As New MMDataSetTableAdapters.V_REPCUSTOMFIELDDATATableAdapter
Dim dt As Data.DataTable = ta.GetSellOffDates("%" & Me.licensorNum.Text & "%", Me.sellOffStart.Text, Me.sellOffEnd.Text)
Me.GridView1.DataSource = dt
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.
-
Apr 15th, 2008, 03:31 PM
#2
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.
-
Apr 15th, 2008, 03:39 PM
#3
Thread Starter
Registered User
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.
-
Apr 15th, 2008, 03:41 PM
#4
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.
-
Apr 15th, 2008, 03:47 PM
#5
Thread Starter
Registered User
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|