Pagination Without Datagrid
Mar 13, 2006
I'm working on a website where we're using .Net web services to feed data to a Flash front-end. The site will have a comments section and we want to display 15 or so comments per page with 'back' and 'next' functionalitiy. We'd also like to show the number of pages of comments and highlight the page they're on. The standard stuff that datagrids do so well.
How can this be accomplished without a datagrid?
There's a good page that explains a number of ways to do this using classic ASP. Some of the solutions they implement I can most likely use with .Net.
http://www.aspfaq.com/show.asp?id=2120
But I wanted to ask the community. How to paginate without a recordset? Sql Server 2000 back-end, ASP.NET 1.x
Thanks.
View 3 Replies
ADVERTISEMENT
Sep 27, 2007
Hi,
My requirement is that when i show data the vertical scroll bar should be disabled.ie,whatever data can be accomodated in a screen should be shown and the rest should go to next page.
I have tried restricting the no of rows shown to 20 but this wont work always as the font size may change.I had used the follwing for this:
<GroupExpression>=Ceiling(RowNumber(Nothing)/20)</GroupExpression>
is there any other way???
please help...
View 1 Replies
View Related
Jan 3, 2006
Hi,
I have recently moved into ms sql from mysql and having problems with
finding a query to help paginate my search results. In mysql I would
use:
SELECT * FROM tablename WHERE something = something LIMIT 0,10
what would a similar query be in sql server?
From what I have experienced so far I know this is going to be a big query!
Thanks in advance
Steve
View 4 Replies
View Related
May 30, 2007
I have a report which consists of a list item, in which is a rectangle containing a header (as a subreport, but I think that's not relevant) and a subreport. The aforementioned rectangle is specified to include a pagebreak after each occurrence, but that pagebreak is not working as expected.
When I run the report I get 1 subreport on the first page, and exactly two on each subsequent page. Other than the pagination, I am getting very close to what I want. It's too bad that the subreport's pagination is ignored, but I can live with that for now.
Things I've already tried:
The report's pageSize and interactiveSize are both set to landscape
The subreport's report's pageSize and interactiveSize are both set to the actual size that the subreport takes up on the main report (which is ignored anyway)
The list does not have any of the page break options selected.
Any Ideas?
View 4 Replies
View Related
Oct 1, 2007
Hi,
I have found the follwing article on internet. This article states two keywords LIMIT and OFFSET using which we can implement the pagination type of functionality in MySQL or PostgreeSQL,
http://www.petefreitag.com/item/451.cfm
But is there any way using which we can implement pagination kind of functionality in SQL.
LIke first time if i set 0 thenm it fetch the records from 1-10 then if i set 10 then it will fetch the next set of records from 11-20 like this,
Can we do it in SQL?????
View 1 Replies
View Related
Oct 4, 2006
Hi
I'm still quite new to MSSQL so excuse the trivial questions.
I've already tried searching through the forums on pagination as im sure its a big subject but couldn't find the answers i'm after.
I'm using MSSQL 2000 and asp .net 2.0 and basically need to paginate my results. My database contains roughly 250,000 rows of data, and one query would approximately return 30 results at the most. I would want to have 5 results per page.
I'm starting from scratch so was wondering what technique i could use. I can't use OFFSET as thats MySQL, is there an equivalent?
I've heard mixed opinions on Cursors, but so far thats the only way i can see at the moment! :S
thanks
View 1 Replies
View Related
Apr 12, 2004
I am a PHP programmer for a small startup. We are storing person records and our MS SQL Server 2000 database has grown to the point where we wish to paginate the data before returning it to my PHP scripts.
I was wondering if anyone has any recommendations on an optimal way to manage this given the following requirements.
- Data must return only X number of rows at a time (user configurable).
- Must be able to search by several diffent criteria (name, date, birthday, location, ...)
Also, I was wondering if it is possible to return the total number of existant rows of data as the first row of a MSSQL procedure.
View 2 Replies
View Related
Jul 20, 2005
Let me know what you think about the following code:DECLARE @MaxIdValue intDECLARE @MaxSortFieldValue nvarchar(50)SELECT TOP 1 @MaxIdValue = [id], @MaxSortFieldValue = [SortField]FROM (SELECT TOP PageNumber*RowsPerPage [id], [SortField]FROM MyTableWHERE (FilterCondition) ORDER BY [SortField], [id]) TORDER BY [SortField] DESC, [id] DESCSELECT TOP RowsPerPage * FROM MyTableWHERE ([SortField] >= @MaxSortFieldValue) AND (([id] > @MaxIdValue) OR([SortField] <> @MaxSortFieldValue)) AND (FilterCondition)ORDER BY [SortField], [id]This is a dynamic SQL and it should be easily fixable.PageNumber, RowsPerPage, FilterCondition and SortField are going to bethe variables and will be based on the user's searchcondition/criteria.-----------------------------Thanks for you attention.
View 2 Replies
View Related
Jan 17, 2007
Hi,
I have a problem with paging in my report. My report is quite simple, I have a table with two grouping levels. Paging is not appearing besides there is a lot of rows displayed.
When I change the report to use only one grouping level, the paging works fine. Is paging being calculated on the first grouping level ? I have about 10 to 20 rows at the first level but about 1500 rows on the second one.
Any help will be appreciated.
View 4 Replies
View Related
Nov 17, 2007
I changed a stored procedure that does pagination from the top style to the
bottom style - mainly to avoid errors in differences in the 2 queries (count
and select) and for conciseness. The performance on a large table for the
bottom query was amazingly bad. The query plan is very different too. It
was about 25 times slower on a 1 million row table. I am familiar with
other pagination techniques (temp tables with identity, TOP-TOP, etc), but
is there a way to use the ROW_NUMBER function AND get a count of records
back in a single query with decent performance?
-- -------------------------------------------------------------
USE NorthWind
DECLARE @cnt Int
SELECT @cnt = Count(*) FROM Customers
;WITH Cust AS
(
SELECT CompanyName, ContactName,
ROW_NUMBER() OVER (ORDER BY ContactName) AS rownum
FROM Customers
)
SELECT *, @cnt AS TRowCount
FROM Cust
WHERE rownum > 10
AND rownum <= 20
ORDER BY rownum
-- -------------------------------------------------------------
-- -------------------------------------------------------------
USE NorthWind
;WITH Cust AS
(
SELECT CompanyName, ContactName,
ROW_NUMBER() OVER (ORDER BY ContactName) AS rownum,
Count(*) OVER() AS TRowCount
FROM Customers
)
SELECT *
FROM Cust
WHERE rownum > 10
AND rownum <= 20
ORDER BY rownum
-- -------------------------------------------------------------
View 10 Replies
View Related
Aug 5, 2004
Hello,
We are migrating from VB6/MySQL to VB6/MS SQL.
The application retrieves limited records for paginated results.
This way we can access large databases, but only return rows for one screen.
For example:
Select row 1 - 10, then 11 - 20 then 21 to 30 etc.
With MySQL we can use LIMIT and OFFSET and it works great.
MySQL
SELECT <columns> FROM <tables> [WHERE <condition>] [ORDER BY <columns>]
[LIMIT [offset,]howmany>]
Does anybody know how we can do something similar with MS SQL?
Any feedback is appreciated!
Thank you,
Edi
View 2 Replies
View Related
Apr 4, 2007
I have a need to perform pagination while using dynamic sorting. Asan exmaple -SELECT TOP(10) * FROM (SELECTTextColumn,DecimalColumn,ROW_NUMER() OVER (ORDER BYCASE @xWHEN 1 THEN TextColumnWHEN 2 THEN DecimalColumnENDDESC) AS SortOrderFROM Table1) AS Results WHERE SortOrder ( 10 ) ORDER BY SortOrderThis is obviously just some sample but an error is given because thedata type of the 2 columns used in the order by are different. Itworks if I cast DecimalColumn to match the textcolumn but then thesorting is wrong. Is there a way to do this in a single query with 2different data types?Thanks for your help.
View 2 Replies
View Related
Jul 20, 2005
I want to build a system that will have about 1 million rows in atable in sql server database.I am using this for a web application andaccessing it via JDBC type 4 driver.But display 20 records at a timeonly using pagination(as in google).What will be the best way to goabout this.
View 1 Replies
View Related
Mar 6, 2008
I would like to know how to show all the records returned (upto 1000) in one single page on a web browser. I am able to get the required report in IE but in case of Firefox it hangs.
Did some test and found that Firefox is able to render a report of upto max 300 records in a single page without getting hanged but report is coming very slow. While you scroll the scroll bar it€™s moving with Jerks. with 200 records in a single page is not getting hanged but report is faster than 300 records display. But by 500 records Firefox hangs. I understand it might be depending on the hardware also but am not sure.
Can anybody give me a good solution to display upto 1000 records in a single page or if its a limitation, where can i get the documentation of it.
Thanks and regards
Niaz Khan
View 8 Replies
View Related
Feb 15, 2007
Hi,
We have developed few reports displaying data using chart layout. In the Data tab, we have specified MDX query that will return top 10 records.
But now, instead of restricting to just top 10 records, we would like to display all records and go in for pagination.
Is there some setting in the chart properties, where in I can display the first n records in first page, and the next n records( if available) in the next page and so on?
Can I specify the value of n somewhere in the propeties?
I read through many posts regarding pagination but those couldn't help me much.
Please help me in solving this problem.
Any help would be appreciated.
Thanks in advance!
View 5 Replies
View Related
Oct 29, 2007
I've got the following query:
WITH OrderedResults AS (SELECT some_table.*, ROW_NUMBER() OVER (ORDER BY some_field) as RowNumber FROM some_table)
SELECT TOP 10 *
FROM OrderedResults
WHERE RowNumber > 10;
which works well for returning "paginated" recordsets. But when it comes to displaying "page" links and next and previous links, I need a total count of records found... something along the lines of the MySQL CALC_FOUND_ROWS feature...
Is there some built-in MSSQL feature I can use for this, or do I have to do a SELECT count(*) FROM some_table to get this data?
Any advice is appreciated
View 1 Replies
View Related
Jan 14, 2007
I am using MS SQL 2000 server db.
I want a parameterised query for pagination support. I want to fetch a records in following order 1-100 then 100-200 , 200- 300 & so on in the format of "First Previous Next Last"
i.e just want to fetch 100 records only per request
How can i do it with MS SQL 2000 server? any suggesions?
Thanks in advance...
View 1 Replies
View Related
Sep 24, 2015
I need sql script where i will pass startindex, endindex and sortcol and order then query return result accordingly. it would be better if query looks small and dynamic.
Here one sample of dynamic sql but there case is used which is not require.
DECLARE @sql NVARCHAR(MAX)
SET @sql = ';WITH cte as(SELECT *,
ROW_NUMBER() OVER
(ORDER BY ' + CASE (@SortColumn + ':' + @SortDirection)
[Code] ...
My requirement is that i will create a sp where i will pass start index and end index and sort column,sort order and filter means where clause and sp will generate and execute dynamic sql and return data. i need a sample of that kind of sp.
View 9 Replies
View Related
Dec 22, 2006
Hi,
I use an embedded ReportViewer control as a LocalReport in a web form. The report displays the results in four pages and I need to display them all in one page (without any pagination). Is there a way to disable pagination? Also, what do I need to do to show the print button in toolbar?
Thanks,
Adarsh
View 3 Replies
View Related
Sep 22, 2015
I know people use ROW_NUMBER() function to do the pagination but my below two query is bit complex. Sohow to use pagination there ? I used ROW_NUMBER() OVER(ORDER BY IsNull(A.OEReference, B.OEReference) ASC) as Line in one but not sure am i right or wrong.
IF IsNull(@GroupID,'') = ''
SELECT IsNull(PartGroupName, 'UnMapped') AS PartGroupName,
CASE IsNull(PartGroupName, '')
WHEN '' THEN ''
ELSE IsNull(IsNull(K.GroupID, IsNull(C.PartGroupID,'')),'')
END AS PartGroupID,
[Code] .....
View 6 Replies
View Related
Jul 6, 2015
I have simplified my question. For complex presentations of data it appears to me that the best practice is to put complicated code into a stored procedure that will make most of the formatting decisions, and keep the SSRS work in the report designer as simple as possible.
The following text is from the original question. I have an SSRS report which contains 2 tablixes. Each tablix has a different dataset coming from separate stored procedures. Currently, everything works good; the user selects one customer (customer A) to display the one page report for; data for customer A for the 1st tablix may contain 7 rows, and data for customer A for the 2nd tablix may contain 4 rows. User prints report, then chooses customer B which may have a different number of rows for each tablix.
I would like to give the user the option to select "All Customers" to display the report for all customers, one page per customer and I currently do not perceive that there is a way to paginate the report; one page per customer. When I pass in "All Customers" to the 2 stored procedures I get all of the correct data back; sorted by customer; so I can do some sort of page break on a row group on the customer name column, but I have 2 tablixes of data.
View 3 Replies
View Related
Dec 19, 2005
I have a tried two different reports one with table and the other without The last textbox in both reports contains enough text which should fill half of first page and half of second page. In both reports the print preview and export to PDF keeps the first page blank and puts all the data in the second page. It appears that the textbox control doesn't know when to place a pagebreak when in print preview and export to PDF. The rdl file has no pagebreaks defined anywhere. Thanks in advance for your help!
View 14 Replies
View Related
Jul 2, 2007
Hi Anyone,
I have a drilldown report includes three groups. I add the last group for pagination. But the details in each page doesn't accord to I specified and the detail record number is different in different page.
Another issue is the interactive sort always sort in the first page scope. I set the data region or grouping to the table, and evaluate expression scrope to Detail scope.
Anyone has experience on that?
Thanks a lot
View 3 Replies
View Related
Aug 10, 2007
I need to take 8 indiviual parts of a table and combine then into 1 Column of a Datagrid. Is this even possible, if so how?
example:
The DB contains:
Comp1 Comp2 Comp3 ... Comp8
The DG should say
header --> Comp
Data --> Comp1, Comp2, Comp3, ..., Comp8
View 4 Replies
View Related
May 6, 2004
hey all
i have 2 tables
1. Location (locid, name)
2. Product (pid, locid, productname, ...etc)
right now i do a select * from product where locid ='locid', and a datagrid with colums
ProductId | ProductName | AvailableIn
how do i do a select * from Location where locid ='locid' and show Location Name in the datagrid?
ProductId | ProductName | AvailableIn
123456 | testing | Somewhere (instead of the locid)
thanks
View 2 Replies
View Related
Aug 29, 2006
Here is my code : string connstring = System.Configuration.ConfigurationSettings.AppSettings["myconn"]; string selectquery = "Select * from nhacungcap"; protected System.Web.UI.WebControls.DataGrid DataGrid1; string insertquery = "Insert into nhacungcap(mancc,tenncc,diachi,dienthoai) values(@mancc1,@tenncc1,@diachi1,@dienthoai1)";string updatequery = "Update nhacungcap set mancc=@mancc, tenncc=@tenncc, diachi=@diachi, dienthoai=@dienthoai where (mancc=@mancc)"; myconnection.Open(); SqlCommand updatecommand = new SqlCommand(updatequery,myconnection);// sua truong mancc updatecommand.Parameters.Add(new SqlParameter("@mancc",SqlDbType.VarChar,10)); updatecommand.Parameters["@mancc"].Value = DataGrid1.DataKeys[e.Item.ItemIndex];// sua truong tenncc updatecommand.Parameters.Add(new SqlParameter("@tenncc",SqlDbType.NVarChar,50)); updatecommand.Parameters["@tenncc"].Value = ((TextBox) e.Item.Cells[3].Controls[0]).Text;// sua truong diachi updatecommand.Parameters.Add(new SqlParameter("@diachi",SqlDbType.NVarChar,200)); updatecommand.Parameters["@diachi"].Value = ((TextBox) e.Item.Cells[4].Controls[0]).Text;// sua truong dienthoai updatecommand.Parameters.Add(new SqlParameter("@dienthoai",SqlDbType.Char,10)); updatecommand.Parameters["@dienthoai"].Value = ((TextBox) e.Item.Cells[5].Controls[0]).Text;// kiem tra lenh thuc thi int result1 = updatecommand.ExecuteNonQuery(); myconnection.Close();// dieu kien kiem tra if (result1 > 0 ) { lbcheck.Text = "Cáºp Nháºt Thành công !"; }// hien thi du lieu hienthidulieu(); And my error appear, when I edit value in datagrid, I only update all value fields, without value @mancc . Hu hu hu, I don't know what i must do with it.
View 1 Replies
View Related
Jul 24, 2007
Hi I'm having a problem deleting rows from my datagrid. Basically I hit delete and a message box pops up and asks if Im sure I want to delete so I hit yes and then I get the following error --> Could not find stored procedure 'delete from SECTION_TBL where SECT_ID = @SECT_ID'.
Is it my code thats wrong or is our test sql server that is the problem?1 <%@ Page Language="VB" EnableEventValidation="True" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>
2 <%@ import namespace="System" %>
3 <%@ import namespace="System.Data" %>
4 <%@ import namespace="System.Data.SqlClient" %>
5
6 <script language="VB" runat="server">
7
8 Dim section As String
9 Dim myconnection As SqlConnection
10 Dim myda As SqlDataAdapter
11 Dim ds As DataSet
12
13 Sub Page_Load(ByVal Source As Object, ByVal E As EventArgs)
14 BindData()
15 End Sub
16
17 Sub BindData()
18
19 Dim strConn As String = "server=fileserver; uid=xxx; pwd=xxx; database=NEW_CMS"
20 Dim sql As String = "Select * from SECTION_TBL"
21 myconnection = New SqlConnection(strConn)
22 myda = New SqlDataAdapter(sql, myconnection)
23 ds = New DataSet
24 myda.Fill(ds, "SECTION_TBL")
25 sectList.DataSource = ds
26 sectList.DataBind()
27
28 End Sub
29
30 Private Sub sectList_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs) Handles sectList.ItemDataBound
31
32 Dim l As LinkButton
33
34 If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
35 l = CType(e.Item.Cells(0).FindControl("cmdDel"), LinkButton)
36 l.Attributes.Add("onclick", "return getconfirm();")
37 End If
38
39 End Sub
40
41 Sub sectList_DeleteCommand(ByVal s As Object, ByVal e As DataGridCommandEventArgs)
42
43 Dim ConnectionStr As String = ConfigurationManager.AppSettings("ConnStr")
44 Dim conn As SqlConnection
45 Dim cmd As SqlCommand
46 Dim Id As Integer
47
48 Id = CInt(e.Item.Cells(0).Text)
49 conn = New SqlConnection("server=fileserver; uid=xxx; pwd=xxx; database=NEW_CMS")
50 cmd = New SqlCommand("delete from SECTION_TBL where SECT_ID = @SECT_ID", conn)
51 cmd.CommandType = CommandType.StoredProcedure
52 cmd.Parameters.Add("@SECT_ID", SqlDbType.Int).Value = Id
53
54 cmd.Connection.Open()
55 cmd.ExecuteNonQuery()
56 cmd.Connection.Close()
57
58 DataBind()
59
60 End Sub
61
62
63
64 </script>
65
66 <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
67
68 <script language="javascript">
69
70 function getconfirm()
71 {
72 if (confirm("Do you want to delete record?")==true)
73 return true;
74 else
75 return false;
76 }
77
78 </script>
79
80 <table cellpadding="2" cellspacing="2" width="760">
81 <tr>
82 <td>Sections</td>
83 </tr>
84 <tr>
85 <td>
86
87 <asp:DataGrid OnDeleteCommand="sectList_DeleteCommand" ID="sectList" runat="server" DataKeyField="SECT_ID" AutoGenerateColumns="False">
88
89 <Columns>
90
91 <asp:BoundColumn DataField="SECT_ID" Visible="False" />
92
93 <asp:HyperLinkColumn HeaderText="SECTION NAME" DataTextField="SECT_NAME" DataNavigateUrlField="SECT_ID" DataNavigateUrlFormatString="manageSection.aspx?SECT_ID={0}" />
94
95 <asp:TemplateColumn>
96 <ItemTemplate>
97 <asp:LinkButton id="cmdDel" runat="server" Text="Delete" CommandName="Delete" CausesValidation="false" />
98 </ItemTemplate>
99 </asp:TemplateColumn>
100
101 </Columns>
102
103 </asp:DataGrid>
104
105 </td>
106 </tr>
107 <tr>
108 <td></td>
109 </tr>
110 </table>
111
112 </asp:Content> Thanks in advance.
View 2 Replies
View Related
Mar 10, 2008
Hi,
I'm trying to use VS2005 to create an ASP.NET 2.0 application. As part of this application I need to be able to read value from a SQL2005 database. I used the connection string builder to create the connection string, but am unable to run a simple SELECT statement. In .NET 1.1, I was able to do this pretty easily, but am unable to even find the same namespaces in .NET 2.0.
For example (VS2003):
'Construct new SQL statement sqlDBDAHulls.SelectCommand.CommandText = "SELECT COUNT('HullID') FROM Hulls" iNoRows = sqlDBDAHulls.SelectCommand.ExecuteScalar
ReDim arrHullClass(iNoRows - 1) ReDim arrHullDesign(iNoRows - 1)
ddlHull.Items.Clear()
For iArrLoop = LBound(arrHullClass) To UBound(arrHullClass) 'Redefine SQL statement sqlDBDAHulls.SelectCommand.CommandText = "SELECT Class FROM Hulls WHERE (HullId = " + Trim(Str((iArrLoop + 1))) + ")" 'Populate array arrHullClass(iArrLoop) = sqlDBDAHulls.SelectCommand.ExecuteScalar 'Redefine SQL Statement sqlDBDAHulls.SelectCommand.CommandText = "SELECT Design FROM Hulls WHERE (HullId = " + Trim(Str((iArrLoop + 1))) + ")" 'Populate array arrHullDesign(iArrLoop) = sqlDBDAHulls.SelectCommand.ExecuteScalar 'Populate combobox ddlHull.Items.Insert(iArrLoop, arrHullClass(iArrLoop) + ":" + arrHullDesign(iArrLoop)) Next iArrLoop
'Close the database sqlConnBC.Close()
This all works absolutely fine.
In VS2005 there does not appear to be the same data adapter and sql client controls and I am starting to pull my hair out. this is what I have:
ASP:
<asp:SqlDataSource ID="connSQL" runat="server" CancelSelectOnNullParameter="False" ConnectionString="Data Source=STREETROD;Initial Catalog=DVD;Persist Security Info=True;User ID=sa;Password=xj600f" DataSourceMode="DataReader" ProviderName="System.Data.SqlClient" FilterExpression="ID" SortParameterName="ID"></asp:SqlDataSource>
VB:
'Connect to database and read values
connSQL.ConnectionString = sConnStr
connSQL.SelectCommandType = SqlDataSourceCommandType.Text
connSQL.SelectCommand = "SELECT COUNT('ID') FROM Users"
iCount = connSQL.Select()ReDim sDbUN(iCount - 1)
ReDim sDbPW(iCount - 1)For iLoop = LBound(sDbUN) To UBound(sDbUN)
connSQL.SelectCommand = "SELECT 'UN' FROM Users WHERE 'ID'='" & Str(iLoop + 1) & "'"
sDbUN(iLoop) = connSQL.Select()
connSQL.SelectCommand = "SELECT 'PW' FROM Users WHERE 'ID'='" & Str(iLoop + 1) & "'"
sDbPW(iLoop) = connSQL.Select()
Next
and all this keeps telling me is that I have not specified any.arguements under System.Web.UI.DataSourceSelectArguments. I have even tried entering System.Web.UI.DataSourceSelectArguments.Empty to no avail
Can someone please give me a code example that will help me understand this, or at least point me in the right direction? Or is that I simply HAVE to use a datagrid?
Many thanks.
ProudFoots
View 3 Replies
View Related
Mar 21, 2008
Hello,
I ran into a little problem. My problem is: i need to substract 2 variabeles from 2 different tables in the database
TitleTimes left todayTimes left
My first excercise!15
My second excercise!19
The fields times left are a calculation... the number of times that the admin entered minus a count in the table scores.
Has anyone an idea how i can solve this?
An example excercise would be great!
Thanks in advance
View 5 Replies
View Related
Mar 22, 2005
please help me to take element in datagrid?
View 1 Replies
View Related
Jul 13, 2005
Hi,I am attempting to achieve some form of report that needs to make use of sql rollup and display it as follows:Category Subject Matter1 Subject Matter2 Subject Matter3 No of CasesClubs Facilities Sport Facilities Swimming Pool 3 SubTotal 3Events SBR/AHM NULL NULL 1 SubTotal 1 GrandTotal 4However, with my sql query, using roll up, it will look like the following which is not correct.Category Subject Matter1 Subject Matter2 Subject Matter3 No of CasesClubs Facilities Sport Facilities Swimming Pool 3Clubs Facilities Sport Facilities NULL 3Clubs Facilities NULL NULL 3Clubs Sub Total NULL NULL 3Events SBR/AHM NULL NULL 1Events SBR/AHM NULL NULL 1Events SBR/AHM NULL NULL 1Events Sub Total NULL NULL 1This is the query I am using:<code>select casewhen (grouping(Cat.Description)=1) then 'Grand Total'else Cat.Descriptionend as Category,casewhen (grouping(sub.description)=1) then 'Sub Total'else Sub.descriptionend as SM1,SubSub.Description as SM2, SM.Description as SM3, count(sub.description)from tb_feedbackcase FB left join tb_category Cat on FB.Category_ID = Cat.Category_ID left join tb_subcategory Sub on FB.SubCategory_ID = Sub.SubCategory_IDleft join tb_subsubcategory SubSub on FB.SubSubCategory_ID = SubSub.SubSubCategory_IDleft join tb_SubjectMatterLV3 SM on FB.SM3_ID = SM.SM3_IDwhere fb.commenttype_id in (select commenttypes_id from tb_comment_types where description = @feedback_type)and convert(char(10),feedback_datetime,102) >= convert(char(10),@date_from, 102)and convert(char(10), feedback_datetime, 102) <= convert(char(10),@date_to, 102)group by Cat.Description, Sub.Description, SubSub.Description, SM.Description with rollup</code>How can I change it to reflect more accurately? Please help. Thanks.
View 1 Replies
View Related
Feb 4, 2006
Hi,
As a relative newbie to SQL Server/ASP.NET I'm hoping someone here can help with my problem. I'm developing a timesheet application in ASP.NET C# using Visual Studio 2003 with a database built in MSDE. One of my forms needs to return a simple list of resources from my database. I have followed the guide on the MSDN libraries, but for some reason I continuously get the same error message.
What I've done so far is Create the database, tables, and populate with some sample data using using Server Explorer in Visual Studio. I have connected to the database (using integrated security) and I am trying to get the contents of the Resource table to appear on my form. I have then created a DataAdapter (tested the connection, set the SQL as a simple SELECT * from Resource, etc), which also generates an sqlConnection for me. To test this I have previewed the generated data, and it returns what I want, so I have chosen to generate a DataSet of this. I am then trying to get this data into a simple DataGrid. On the properties of the DataGrid I have changed the DataSource to point at my Dataset. As I understand it, I then have to add the following to my Page Load section of my code.
sqlConnection1.Open();this.sqlDataAdapter1.Fill(this.dsResource);DataGrid1.DataBind();sqlConnection1.Close();
The form builds fine, but when I browse to the particular form I get the following error for the sqlConnection1.Open(); line. If I remove this line the error simply moves to the line below.
Exception Details: System.Data.SqlClient.SqlException: Cannot open database requested in login 'SCMS'. Login fails. Login failed for user 'AL-NOTEPADASPNET'.
To me this is an error with my connection string. My database instance is actually 'AL-NOTEPADVSDOTNET'. However the properties for sqlConnection1 are pointing to the correct datasource. I do not know why the application is looking for user 'AL-NOTEPADASPNET'. It does not exist, to my knowledge. Do I need to grant access to this user? If so, how would I do it? Bearing in mind I am using MSDE, and do not have Enterprise Manager.
Any help with this would be greatly appreciated, as I get the same error with my code for forms-based login...
Thanks in advance..
View 2 Replies
View Related
Jul 23, 2005
Hi,No I don't want to loop through my dataset ;) I want to loop through mydatagrid to retrieve the values in each cells, but I don't know how todo that ?Can someone help ?thx
View 1 Replies
View Related