Tracking Forums, Newsgroups, Maling Lists
Home Submit Tracker Forums
  Advanced Search
  HOME    TRACKER    ASP.NET


Advertisements:










SQL Server :: Count Identical Data As One?


I have a db table MemberOccasion with two columns: memberID and occasionID where I keep members votes for occasions. A member can vote for several occasions. Every time a vote is inserted I need to check how many members have voted (and compare against the number of registered member in another table, but I do the comparison outside of this query). My question is this: Is it possible to do adjust the query below to accomplish this?

This is how I count all memberID in MemberOccasion:

[Code]....

with the result that the data in the table below would be counted as 8. Instead I need to count each memberID once. The result I want is that five members have voted.

memberID occasionID
1 28
1 30
2 30
3 29
4 30
5 28
5 29
5 30


View 6 Replies (Posted: Mar 28, 2011 08:58 AM)

Sponsored Links:

Related Forum Messages For ASP.NET category:
Forms Data Controls ::Repeater Works But FormView Won't When Using Identical DataSourceID?
I have a bizarre situation where a repeater displays the records from an ObjectDataSource no problem,but in the same UserControl,a FormView bound to the same ObjectDataSource will only ever display it's EmptyDataTemplate.Even with my FormView's DefaultMode set to Insert it still only ever shows the EmptyDataTemplate.

Posted: Sep 28, 2009 11:29 AM

View 1 Replies!   View Related
Forms Data Controls :: Status Needs To Changed When Two Textbx Values Are Identical
I have two textboxes on my webform txtOQty,txtShipQty and Status dropdown list having 3 options.Active,hold,Completed.When txtoqty=txtShipQty then status should changed to Completed.Can any one help me on this,thanks.

Posted: Jan 25, 2011 03:50 AM

View 4 Replies!   View Related
Forms Data Controls :: GridView_RowUpdated Event The E.OldValue.count E.NewValue.Count
In the GridView_RowUpdated event the e.OldValues.count <> e.NewValues.Count. 1 out of 5 columns has been converted to a template field.

Posted: Jun 04, 2010 03:08 PM

View 9 Replies!   View Related
Forms Data Controls :: Gridview Row Count / How To Get A Count Of The Number Of Rows That Are Returned
When a user submits the queryto SQL when clicking a buttonI need to get a count of the number of rows that are returned. Which event does the gridview.count code need to be place in?

Right now I have it in the btn_click event, but in order to get it to count the rows you have to hit the button twice since the query is not returned yet. Here is my code.

[Code]....

Posted: Dec 17, 2010 05:25 PM

View 1 Replies!   View Related
SQL Server :: Count How Many Rows Are In Data Table
I have a data table called Songs It has SongId as Primary Key of type INT SongName of Type VarChar UserId of Type Int. I simply want to check how many entries are in the Table already by The UserId before they insert more. So If there are already 3 songs by that User, I want to stop the insert process and warn them they have the maxium already. I think i am halfway there already using code below but problem is that UserId is of Type GUID, and not Int so I am missing something. On my Aspx, Page, I have a DetailsView for the Database Insert. I also have the following code using BusLogic Layer and DAL

SongsBLL
public int ScalarQuery(Guid ArtistId)
{
int returnValue = ScalarQuery(ArtistId);
return returnValue;
}
Code Behind ASPX page
This in in DetailsView_ Item Inserting Event
SongsBLL number = new SongsBLL();
currentCount = Convert.ToInt32(number.ScalarQuery(currentCount).ToString());..........

Posted: Mar 05, 2011 04:09 PM

View 9 Replies!   View Related
C# - Best Way To Merge Two Identical Websites?
We have two websites which only difference is in the design (different images, styles, layouts..etc) but the web structure of files and cs code is the same so we want to simplify its maintenance...

The actual structure would be:

DefaultA.aspx
DefaultA.aspx.cs
DefaultB.aspx
DefaultB.aspx.cs
LoginA.aspx
LoginA.aspx.cs
LoginB.aspx
LoginB.aspx.cs

One idea would be changing the design differences at runtime depending of the origin website, but we dont like much this because performance, abstraction in designing them and url confusion...

Another one is sharing the cs (both aspx inheriting and using the same cs) file but we never have done or seen it done in any website before so we wonder if its a good approach...

Posted: Jun 17 10 at 15:18

View 5 Replies!   View Related
C# - How To Remove Identical Items From List
I have a List in which I select users from db each time a sql query runs with certain value and selects one user in the time thus I cannot limit identical users in sql.

I have list with:

list[0] = "jerry"
list[1] = "tom"
list[2] = "jerry"

I want any (first or last doesn't matter in my case) to be removed from the list.

Posted: Oct 4 10 at 10:24

View 5 Replies!   View Related
Web Forms :: Web Application Displays Pages Different On Identical Machines?
What I am investigating has got me stumped as is a turning out to be quite an interesting problem. A .net 1.1 web application that has been running steady the last 5 or so years on IE6 and IE7 all of a sudden does not redender the pages properly on IE7 for me (one of the developers). I am now the second person to experience this in our team where the other members have no issues displaying the web application on IE7. Our development environments are iMacs with VMWare Fusion Windows XP SP3 images.

So the Scenario:

2 Machines, same XP SP3, same IE7 versions (settings are all default), latest Windows Updates, and both display our pages different (one works as before and the other, the positioning is all out of line).

If anyone has any ideas, I will promptly implement and if any one would requires additional information, just request.

Posted: Nov 16, 2009 01:54 PM

View 7 Replies!   View Related
DataSource Controls :: Use Two Identical SQL Databases Local And Remote?
I am developing a website with ASP.NET pages that uses an SQL Server database with LINQ to SQL. I am using Visual Studio's Web Developer along with SQL Server 2008 (Developer Edition) database tables on my personal PC to develop this software. When ready, I intend to transfer the compiled web pages to a web hosting service with an SQL server database that is identical to the database on my PC.

I now have a version of my website deployed on a web hosting service at: [URL] and all of my database tables duplicated at the remote SQL server. However, this version of my website does not work with the database yet.I realize that I can have the VS Server Explorer connect to both databases, but I do not know if the web pages on my PC can use both databases interactively.

I am asking how I can develop my website to use the local SQL Server database and then have the deployed pages use the remote SQL Server database with LINQ to SQL. Do I need to create one version that works with the local database and another deployable version that works with the remote database? What should I do?

Posted: Mar 13, 2010 09:29 AM

View 5 Replies!   View Related
Web Forms :: Process An Identical 80 Control Form From 5 Different Pages?
I have a project that uses the same form on 5 different dynamic pages. The form will be in an updatepanel (I have no problems with that). My question is how can I populate the form with data and process the data on a centralized class? This form has about 80 controls on it.

I work in VB.

I've given up on trying to programatically generating/injecting the updatepanel/table into the contentplaceholder. (I got it to work but I could not read ANY of the fields even using nested FindControls). So now I've backed up to 5 instances of the form in easy to use UpdatePanels. But I cannot justify writing 5 identical form processor code blocks in 5 different classes.

Posted: Apr 06, 2010 10:02 PM

View 2 Replies!   View Related
Setup Identical <machinekey /> Sections On Each Servers .config File?
We have a scenario using asp.net Forms Authentication in a web farm and need to setup identical <machinekey /> sections on each servers .config file.

Is it better to store the <machinekey /> section in machine.config rather then web.config? what's the advantages and disadvantages of each approach concerning security?

<machineKey validationKey="[keyhere]"
decryptionKey="[keyhere]" validation="SHA1" />

If its not secure enough, is there any way to encrypt <machinekey /> section like we encrypt our connectionsstring (with DPAPI)? (http://msdn.microsoft.com/en-us/library/ms998280.aspx)

Posted: Mar 2 10 at 19:33

View 1 Replies!   View Related
SQL Server :: Sql Count Greater Then 10?
I have a Sql query (I made it shorter for an example) belowselect top 4 Count (distinct[x].ProductID ) as [Count], y.Category as Category FROM [y] left OUTER JOIN [x] on [x].CategoryID = [y].CategoryID where x.MainID in (SELECT item FROM split(@MainID, ';')) group by y.Category order by Count descthe results will show all Categories with the Count next to it... I need to get the sql query to only get all the Categories with a Count greater then 10...How can I get this?.. .........what do I need to do to let the Sql Query work?

Posted: Sep 14, 2010 08:30 AM

View 3 Replies!   View Related
SQL Server :: Get A Count For Current Quarter?
I'm trying to get a count based on current quarter. I can get month with the following, but not sure what to do for quarter count.

[Code]....

Posted: Feb 16, 2011 06:12 PM

View 1 Replies!   View Related
SQL Server :: Query - Count With Restrictions?
I have a table students(studId, student) and 1000 records

1. I want to see in how many distinct name, thier frequequency

2. show only the records with frequency greater than 3

Posted: Dec 27, 2010 10:33 PM

View 2 Replies!   View Related
SQL Server :: Count Posts For Each Topic?
Thereare 2 tables [forumitems] and [forumitemsblog]

forumitems has the itemid,itemdescription,datecreated,whocreated fields

forumsitemsblog has the itemid,blog

I need to show how many posts are in each item description using the itemid so like count(blog) where itemid=itemid

[Code]....

Posted: Oct 26, 2010 03:54 PM

View 5 Replies!   View Related
SQL Server :: Count Occurrences In Bridge Table?
Im looking for a sql solution for counting records in a bridge table. I want to select all in table1 and add a column with count of each author's titles. Ive tried

SELCET Table1(*), COUNT(DISTINCT table.au_id) AS Titles

but keep getting an error.

The tables I have are as follows:

Table1(
au_id
au_fname
au_lname
ect..)
Table2(
au_id
title_id)
Table3(
title_id
title_name)

Posted: Nov 22, 2010 11:15 PM

View 4 Replies!   View Related
Possible To Count The # Of Users (based Off Sessions) From Another Server?
I've got a site on one server, and I want to display the # of users currently logged into another site on another server. I know how to do this if it was on the same server, but how do I count how many sessions are currently active on another server? Is this possible? Have an example or a starting point for me?

Posted: Dec 05, 2008 03:04 PM

View 4 Replies!   View Related
SQL Server :: Count Number Of Stored Procedure?
I have many stored procedure in database sql server , so ow can i count the number of stored procedure which tel me the result

like for example i made39 sps but i dnt know

Is there any way to count the number of stored procedures in specific database?

Posted: Nov 23, 2010 12:15 PM

View 7 Replies!   View Related
SQL Server :: List All Dates In Date Range When Selecting Count
Say I have a table called "Visits", and I want to create a query that counts the visits per day.The way I would accomplish this would be to create a query as such:

SELECT Count(VisitId) as VisitCount, Convert(varchar(32), VisitDateTime, 101) as VisitDate
FROM Visits
WHERE VisitDateTime BETWEEN '10/1/2010' AND '10/5/2010'
GROUP BY VisitDate

The problem I am trying to overcome is that if there were no visits in a given day, that day does not show in my list. For example, if there were 3 visits on the 1st, 2 on the 2nd, none on the 3rd, and 5 on the 4th, my result set would look like:

3, 10/1/2010
2, 10/2/2010
4, 10/4/2010

How can I create my query so that I get all days in the date range listed in the result set regardless of whether the VisitCount is zero?

Posted: Oct 11, 2010 03:27 PM

View 1 Replies!   View Related
SQL Server :: Assign Result Of Count Stored Procedure To C# Variable?
I have an aggregate stored procedure (named sp2) that returns a count of records meeting a certain criteria ASrecCount.I am using a DAL per the ASP.NET tutorialand have created a Table Adapter (named
sp2TableAdapter) with GetData and Fill methods. I have a button on an ASP.NET page that launches an event handler. In the button's event handler, I have this line:sp2TableAdapter sp2 = new sp2TableAdapter();
What works so far:

This code will bind the value of sp2 to a data control:

sp2TableAdapter sp2 = new sp2TableAdapter();
DropDownList1.DataSource = sp2.GetData();
DropDownList1.DataValueField = "recCount ";
DropDownList.DataTextField = "recCount";
DropDownList1.DataBind();

When running this page and clicking the button, the numeric value of recCount returned from sp2 is bound to the DropDownList control and 1 row is poplated with the recCount value (in my case 1451).

Problem:
In the event handler, I do not want to bind the value of recCount to a control, but want to to use it in some logic as an integer. What is the C# code that will do this? (In place of the DropDownList control lines above)

Posted: Aug 07, 2010 01:30 AM

View 2 Replies!   View Related
SQL Server :: Returning Value By Comparing Row Count & Checking With User Name Not Working?
I have Create user form through which i am creating thousands of users and generating unique user id's. If there are lot of concurrent users using the form then how should I display the new generated user id to user through stored procedure I have tried returning the value by comparing row count and checking with user name but its not working in fast way.I am displaying the user id on form itself.Any alternate solution for this?

Posted: Mar 24, 2011 06:21 PM

View 3 Replies!   View Related
SQL Server :: Use Row_number Function And Select Count(date_time) From Datos This Query?
I have many record in my sql table and i want to fetch last row of table.I have used max function but it is very slow

i m using this query-

select pm_name from datos where date_time = (select Max(date_time) from datos) but it takes more time i want to use select count(date_time) from datos this query provide me row number then how can fetch row of this number.

Posted: Feb 09, 2011 05:37 AM

View 11 Replies!   View Related
SQL Server :: Script To Insert Records From One Table Into The Other Times Original Tables Count Field Value?
Ihave 2 table's

Table 1: Daily_item

Fields:Key_GuidDrescription Count

1test3

3new item 2

Iwant to insert records formtable 1 intotable 2 but using the count fieldto duplicate the Key_guid recordthe new table.

New table example:

Table 2

Key_guid

1

1

1

3

3

Posted: Jan 28, 2011 07:39 PM

View 5 Replies!   View Related
Web Forms :: Loop Through A Dataset With A Count At Each Loop And Append That Count To A Label?
Iwant to loop through a dataset with a count at each loop and append that count to a label. So at each loop it writes to the next label.

Ex. lbl(count).text

Is that possible or should I approach this some other way?

Posted: Nov 30, 2009 06:22 PM

View 8 Replies!   View Related
Forms Data Controls :: How To Count Total Record In Data Grid And Export To Excel
how tocount total record in my datagrid and after that export the records to excel ?

Below are the coding of my datagrid .

GridView id="grdCustomer"
void Data()
{
qry = "select * from customer order by customerId DESC";
DataSet ds = new DataSet();
ds = DBUtil.getTable(qry);
if (ds.Tables[0].Rows.Count != 0)
{
grdCustomer.DataSource = ds;
grdCustomer.DataBind();
}
else
{
lblMsg.Text = "Customer List Is Empty";
}
}

Posted: Aug 06, 2010 01:37 AM

View 2 Replies!   View Related
SQL Server :: Returning A Date With A Count Of Zero If It Doesn't Exist In The Date Range
i have the following query.

[code]....

but if there were no "hits" for a particular date range in the last week i only get the dates returned where there were hits. i need to get all the days returned and where there were no results, i need a zero returned.

hitdate hitsperday

2010-10-07 2
2010-10-06 58
2010-10-04 1645
2010-10-03 1192

what i need to return is this:

hitdate hitsperday

2010-10-08 0
2010-10-07 2
2010-10-06 58
2010-10-05 0
2010-10-04 1645
2010-10-03 1192

Posted: Oct 09, 2010 05:30 AM

View 3 Replies!   View Related
Possible To Find Row Count Of A Table Using Data Reader
is it possible to find row count of a table using data reader?

Posted: Dec 24 10 at 12:42

View 3 Replies!   View Related
Forms Data Controls :: Row Count In Gridview In C#?
i have a datagrid with paging on my .aspx page now i want the footer of the grid to display the total count of row on page and the grand total also

like

1-10 of 50

11-20 of 50

i got this code from somewhere but not working.

protected void GridView1_DataBound(object sender, EventArgs e)
{
// Set the text in the first cell of the footer row to equal the number of
// Rows in the GridView
GridView1.FooterRow.Cells[0].Text = String.Format("Total: {0}",
GridView1.Rows.Count.ToString());...............

Posted: Feb 26, 2010 06:30 AM

View 7 Replies!   View Related
Forms Data Controls :: Total Row Count Of GridView?
I am trying to display the total row count for the GridView with having Paging enabled, if I use GridView1.Rows.Count property it give the row count for that specific page. Is there anyway I can display total row on the page ? I am using SqlDataSource.

Can I assign SqlDataSource to DataSet so that I can use DataSet.Table[0].Rows.Count property ?

Posted: Jul 12, 2006 10:22 PM

View 6 Replies!   View Related
Forms Data Controls :: How To Count Items In A DataList
How can I count total items in a DataList selection?

This is what I tried, didnt work:

Protected Sub countitems(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataList1.DataBinding
Label1.Text = Label1.Text & DataList1.DataKeys.Count
End Sub

Posted: Sep 23, 2009 11:39 AM

View 2 Replies!   View Related
Forms Data Controls :: Datalist Item Count?
i have 3 items in my dataliste but the

Label46.Text = DataList2.Items.Count gives me 2.


Posted: Sep 29, 2010 02:34 PM

View 10 Replies!   View Related
Forms Data Controls :: DataList Record Count?
I am creating a web app that using a DataList for display and editing purposes. A datareader is used to populate the DataList. I have the total number of records in the Datalist being displayed in the Footer. In the DataList, I have a checkbox. How can I iterate thru each record in the Datalist to get the number of checkboxes that are checked?

Posted: Jun 24, 2010 07:22 PM

View 2 Replies!   View Related
Forms Data Controls :: Count The Records In A Gridview?
I habe a arraylist that can pass in the result of a quiz and once the user finishes this quiz, theresult will be displayed in a gridbiew which isbinded into a sqldatasource.In this gridbiew, there is this column which will highlight the the result of this qn whichdisplays correct and incorrect.what i want to do now is, i want to count the number of correct answers. I want to count all the correct answers and bind it to a label in the same page.

Posted: Jan 20, 2010 10:29 AM

View 2 Replies!   View Related
Forms Data Controls :: Get Dataitem Count For Listview?
let's say i have a listview, and how do i get the listview items from code behind? either in page load or the onitemdatabound for list viewi've just tried onelistview1.items.countit's not working, i should have 29 records but it returns 0in formview, i could use formview1.dataitem.counti know the listview is different, anyone could help me on this?

Posted: Dec 03, 2009 10:13 AM

View 5 Replies!   View Related
Forms Data Controls :: Get Count Sms In Day And Return SmsDate?
data table

i want to get count sms in day and return smsDate and Sms Cont

now i want use these value in chart

Posted: Mar 03, 2011 04:14 PM

View 1 Replies!   View Related
Forms Data Controls :: Fetch Count Of Products?
Im haveing three tables T1 ,T2, T3. T1 contain root node for tree view, T2 contain child node and T3 contain product.Im populating the tree view from T1 and T2. Now I want count of products in each subcategory in front of each child node(T2). The products are being uploaded by user.Plz help how to achive this.The code to populate the tree view :

if (!IsPostBack)
{
//Fill the treeview control Root Nodes From Parent Table

[code]...

Posted: Apr 12, 2010 11:07 AM

View 15 Replies!   View Related
Forms Data Controls :: Getting Inaccurate Row Count In Repeater?
I've got a Repeater object and I'm trying to put a conditional in when I'm to the last item. I thought this would be just a simple matter of checking when...

<%# MyRepeater.Items.Count == Container.ItemIndex ? "This is the last item." : "" %>

However, this doesn't work. MyRepeater.Items.Count is not a constant number throughout every cycle of the Repeater, as I thought it would be, but instead it is always equal to Container.ItemIndex. This doesn't seem right. how to get an accurate count of every last item in the Repeater? I'm populating MyRepeater from my C# code-behind like so...

sql = "SELECT * FROM MyTable";
SqlCommand cmd = new SqlCommand(sql, sqlConn);
MyRepeater.DataSource = cmd.ExecuteReader();
MyRepeater.DataBind();

Posted: Aug 03, 2010 09:19 AM

View 8 Replies!   View Related
What The Diffrence Between Users.count And Users.keys.count
How can i write this line: string[] nicks = new string[ users.Count ]; - using vb.net?

when:

users = new
Hashtable();

and also what the diffrence between: users.count and users.keys.count?

Posted: Dec 18, 2008 02:28 PM

View 2 Replies!   View Related
Add Code To Know Visitors Count And Online Visitors Count?
How to add code to know visitors count and online visitors count ?

is there a good control or code ?

I use ASP.Net, C#.Net ad SQL Server

Posted: Jan 05, 2011 05:03 PM

View 5 Replies!   View Related
Copyright 2005-08 www.BigResource.com, All rights reserved