473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

NO DATA RETURNED IN GRIDVIEW

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.

Aug 16 '06 #1
2 1361
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

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
<jo***@norrisinc.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
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.

Aug 17 '06 #2

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!

Aug 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
2
by: Ian | last post by:
Hiya, Hope this isn't too stupid a question :) I can bind an objectdatasource to a gridview very easily (and there's a thousand tutorials of this on the net). BUT! I just want to get at...
1
by: Siva | last post by:
Hi, In my ASP.Net 2.0 app, I have a gridview whose data is being populated using an object data source which retrieves data from a data access layer. The Select method returns a static list of...
8
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to...
2
by: =?Utf-8?B?dmFuZGls?= | last post by:
I have a web app that I have been working on for the last couple of weeks trying to solve this problem. One page contains a GridView with four base columns, and an unknown number of columns to be...
1
by: G | last post by:
Hello, Fairly new to .net (using c#). I am running an SQL query which always returns ONE ROW and no more. I would like to have the ID field of the returned row bound to a TextBox onSubmit. ...
0
by: Adam Sandler | last post by:
Hello, Prior to posting I looked at http://groups.google.com/group/ microsoft.public.dotnet.framework.aspnet/browse_thread/thread/ d8d5ae243614085e/d4fd6c4a5aa56f75 ...
0
by: =?Utf-8?B?S3VydCBvZiBTYW4gSm9zZQ==?= | last post by:
All- Please advise as to what's the best way to display data in a column in a grid view (and I'm using a dataset) in a table (say TABLE2) which: - is non-zero only if a boolian field in the...
4
by: csgirl87 | last post by:
I am new to asp.net i am using it with vb.net language i had do the code .. and it is returning the result in a textbox right now cause i don't know how to returned it in a gridview .. i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.