NO DATA RETURNED IN GRIDVIEW

J

joshd

HELP!

I HAVE A GRIDVIEW ON A ASP PAGE BOUND TO A STORED PROCEDURE, THE STORED
PROCEDURE WORKS FINE ON THE SQL SERVER, AND WHEN I TEST THE DATA SOURCE
ON THE ASP PAGE IN VISUAL STUDIO IT RETURNS THE CORRECT DATA. BUT WHEN
I RUN THE WEB PAGE, NO DATA IS RETURNED INTO THE GRIDVIEW!

HERE IS THE CODE:

ALTER PROCEDURE SP_INSPECTIONSUMRY
@MONTH VARCHAR(30),
@OFFICE VARCHAR(30)
AS

SELECT I.NUMBER AS INVOICE, I.PRODUCT, I.CONTACT, I.PHONE, F.NUMBER,
I.CODE, I.STATUS, I.BASE_QTY AS BILLFREQ, F.FREQ, F.DATEIN,
I.NAME, I.DESCRIPTIO, I.TOTAL_PROJ, I.HOURSLABOR
INTO #TEMP_INSPECTIONSUMRY
FROM OPENQUERY(PROJECTS, '
SELECT NUMBER, CONTACT, PRODUCT, PHONE, CODE, STATUS, BASE_QTY,
DATEIN, NAME, DESCRIPTIO, TOTAL_PROJ, HOURSLABOR
FROM PROJMAST
WHERE PRODUCT in ("L", "E", "V", "P") AND STATUS="G"') I
LEFT JOIN (SELECT NUMBER, BASE_QTY AS FREQ, DATEIN
FROM OPENQUERY (PROJECTS, '
SELECT NUMBER, BASE_QTY, DATEIN
FROM PROJMAST
WHERE PRODUCT="F" AND STATUS="G"')) F
ON (LEFT(F.NUMBER, LEN(F.NUMBER)-2))=(LEFT(I.NUMBER,
LEN(I.NUMBER)-2))

IF @MONTH = 'JANUARY' AND @OFFICE = 'BANGOR'
SELECT CONTACT
FROM #TEMP_INSPECTIONSUMRY

ELSE IF @MONTH = 'FEBRUARY' AND @OFFICE = 'SP'
SELECT INVOICE
FROM #TEMP_INSPECTIONSUMRY


-________________________________________________________________________
and the ASP is:


<asp:DropDownList ID="Office" runat="server">
<asp:ListItem></asp:ListItem>

<asp:ListItem Value="JANUARY">JANUARY</asp:ListItem>
<asp:ListItem>FEBRUARY</asp:ListItem>
<asp:ListItem>MARCH</asp:ListItem>
<asp:ListItem>APRIL</asp:ListItem>
<asp:ListItem>MAY</asp:ListItem>
<asp:ListItem>JUNE</asp:ListItem>
<asp:ListItem>JULY</asp:ListItem>
<asp:ListItem>AUGUST</asp:ListItem>
<asp:ListItem>SEPTEMBER</asp:ListItem>
<asp:ListItem>OCTOBER</asp:ListItem>
<asp:ListItem>NOVEMBER</asp:ListItem>
<asp:ListItem>DECEMBER</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="Month" runat="server">
<asp:ListItem></asp:ListItem>

<asp:ListItem Value="BANGOR">BANGOR</asp:ListItem>
<asp:ListItem Value="GREENLAND">GREENLAND (NH)</asp:ListItem>
<asp:ListItem Value="SP">SOUTH PORTLAND</asp:ListItem>
<asp:ListItem Value="UNH">UNIVERSITY OF NH</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" Text="Button" /><br />
<asp:GridView ID="GridView1" runat="server" BackColor="White"
BorderColor="#DEDFDE"
BorderStyle="None" BorderWidth="1px" CellPadding="4"
DataSourceID="INSPECTIONSUMRY"
ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True"
ForeColor="White" />
<PagerStyle BackColor="#F7F7DE" ForeColor="Black"
HorizontalAlign="Right" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True"
ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="INSPECTIONSUMRY" runat="server"
ConnectionString="<%$ ConnectionStrings:pROJECTSSQL %>"
SelectCommand="SP_INSPECTIONSUMRY"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="Month" Name="MONTH"
PropertyName="SelectedValue"
Type="String" />
<asp:ControlParameter ControlID="Office" Name="OFFICE"
PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>


I appreciate any help, Thanks.
 
D

David Wier

At first sight: All your listitems are in the wrong DropDownLists - all your
Months are in the Office DDL - all your offices are in the Months DDL
 
J

joshd

Thank you, i knew it had to be something simple, i had just stared at
it so long that i couldn't see it. Thanks!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top