Tracking Forums, Newsgroups, Maling Lists
Home Submit Tracker Forums
  Advanced Search


DataSource Controls :: Select The Record , Count Them And Show Them In Datagrid?

I have3 tables. I have to select the record and count them and show them in datagrid.

View 3 Replies (Posted: Dec 09, 2009 08:27 AM)

Sponsored Links:

Related Forum Messages For ASP.NET category:
DataSource Controls :: Row Count Shows 1 Record But There Is No Record In Database Table
I am counting from a table for that i have written code as below

protected void get_Id_Afterpoint()
int counter = 0;
string strSql = "select count(*) as ID from tblEnergy where ID=?";
OdbcCommand com = new OdbcCommand(strSql, con);
com.Parameters.AddWithValue("ID", DropDownList1.SelectedValue);
OdbcDataAdapter oda = new OdbcDataAdapter(com);
DataTable dt = new DataTable();
if (dt.Rows.Count == 0)
lblID2.Text = "1";
counter = dt.Rows.Count;
counter = counter + 1;
lblID2.Text = Convert.ToString(counter);

there is no record related to DropDownList1.SelectedValue. but as i am counting if(dt.rows.count) and i put break point on the bolded part it shows 1 record. how it can be possible?

Posted: Jun 24, 2010 05:43 AM

View 5 Replies!   View Related
Forms Data Controls :: Pop Up To Show When No Record Is Selected And Tell The User To First Select A Record?
I have a delete button bellow my gridview and I want a pop up to show when no record is selected and tell the user to first select a record. The button click event would show the pop up, but my gridview data blanks out.

Here is my code:


Posted: Mar 21 at 18:55

View 1 Replies!   View Related
DataSource Controls :: Displaying Total Record With Count?
I have the following ...

<asp:SqlDataSource ID="totalcount" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT COUNT ([CID]) FROM [WWAMembers] WHERE([CID] IS NOT NULL)"></asp:SqlDataSource>

how do I get the totals displayed with label or other control?

Posted: Dec 12, 2010 04:54 PM

View 3 Replies!   View Related
DataSource Controls :: Get Record Count With Related Table?
I want to get record count from below example.

I made two tables. One is club_info and another one is club_members.

And each table has data like following


I want to get club_name andthe member count for selected club_id and want to return the result as sqldatareader.

Posted: May 17, 2010 11:03 AM

View 8 Replies!   View Related
DataSource Controls :: SQL Select Inner Joins Using Count
I have a SQL select statement with inner joins to get a total number of records for the statement. I have tried using count with group by's but it just counts one for each record instead of giving me the total number of records for the query. Here is the query:


Posted: Mar 17, 2010 04:07 PM

View 3 Replies!   View Related
DataSource Controls :: Count From Several Tables In One Select Statement
I am trying tocount records belonging to a certain person inthree different tables in a single select statement.The database looks like this:



-GameId (FK->Game.GameId)
-PlayerId (FK->Player.PlayerId)
-Assist (FK->Player.PlayerId)

-GameId (FK->Game.GameId)

I want toselect the numberof goals, assist and cards a player has in a specific tournament. I tried with this query but thenthe goal and card column shows the sum of the number of rowsmatching the playerid in the Goal table and the Card table...For example if there is two matching rows in the goal table and three matching rows in the card table, I get 5 in both these columns in the resultset.


Posted: Mar 14, 2010 01:45 PM

View 3 Replies!   View Related
DataSource Controls :: Select Statement Where Character Count Equals Specific Number?
Anyone knowhow towrite a select statement to where it returnsresults that have a specific character count? I want to return all results that have 5characters.

Posted: Mar 22, 2010 02:12 PM

View 1 Replies!   View Related
Datagrid No Data Show While Sp Run Has Record
I do not know why drCertification.RecordsAffectedreturn as -1. I tested session has value and I ran the sp , it has record. Thanks.

<asp:datagrid id="dgCertification" runat="server" Width="860px" GridLines="Horizontal" CellPadding="2" AlternatingItemStyle-BackColor="Linen" HeaderStyle-BackColor="LightGrey" HeaderStyle-Font-Bold="true" HeaderStyle-Wrap="false" AllowSorting="True" AutoGenerateColumns="False"
DataKeyField="ID" BorderWidth="1px" BorderColor="LightGray" BorderStyle="Ridge" ShowFooter="True">
<EditItemStyle BackColor=teal></EditItemStyle>
<AlternatingItemStyle BackColor="Linen"></AlternatingItemStyle>
<HeaderStyle Font-Bold="True" Wrap="False" BackColor="teal"></HeaderStyle>
<FooterStyle BackColor="LightGray"></FooterStyle>
<asp:TemplateColumn HeaderText="Certification" HeaderStyle-ForeColor="#0000ff">
<asp:Label id=lblCertification runat="server" Text='<%# Container.DataItem("Certification") %>'>
<asp:TextBox id="txtCertification" MaxLength=50 runat="server" Width="75px"></asp:TextBox>
<asp:TextBox id="txtCertificationE" MaxLength=50 runat="server" Text='<%# Container.DataItem("Certification")%>' Width="75px"></asp:TextBox>
<asp:TemplateColumn HeaderText="Date Obtained" HeaderStyle-ForeColor="#0000ff">
<asp:Label id=lblCDateObtained runat="server" Text= '<%# DataBinder.Eval(Container, "DataItem.CDateObtained", "{0:d}") %>'>
<asp:TextBox id="txtCDateObtained" runat="server" Width="75px"></asp:TextBox>
<asp:TextBox id="txtCDateObtainedE" runat="server" Text= '<%# DataBinder.Eval(Container, "DataItem.CDateObtained", "{0:d}") %>' Width="75px"></asp:TextBox>
<asp:TemplateColumn HeaderText="Expiration Date" HeaderStyle-ForeColor="#0000ff">
<asp:Label id=lblCDateExpiration runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CDateExpiration", "{0:d}") %>'>
<asp:TextBox id="txtCDateExpiration" runat="server" Width="75px"></asp:TextBox>
<asp:TextBox id="txtCDateExpirationE" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CDateExpiration", "{0:d}") %>' Width="75px"></asp:TextBox>
<asp:LinkButton id="lnkbutEdit" runat="server" Text="<img border=0 src=../images/im_edit.gif alt=edit>" CommandName="Edit" CausesValidation="false"></asp:LinkButton>
<asp:LinkButton id="lnkbutUpdate" ValidationGroup ="CDate" runat="server" Text="<img border=0 src=../images/im_update.gif alt=save/update>" CommandName="Update"></asp:LinkButton>
<asp:LinkButton id="lnkbutCancel" runat="server" Text="<img border=0 src=../images/im_cancel.gif alt=cancel>" CommandName="Cancel" CausesValidation="false"></asp:LinkButton>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<asp:LinkButton id="lnkbutDelete" runat="server" Text="<img border=0 src=../images/im_delete.gif alt=delete>" CommandName="Delete" CausesValidation="false"></asp:LinkButton>
<FooterStyle HorizontalAlign="Center"></FooterStyle>
<asp:Button id="btnAddRow" runat="server" Text="ADD" CommandName="AddANewRow" ValidationGroup ="CDate"></asp:Button>
Public Sub LoadCertification()
'Dim myConn As New SqlConnection
Dim DBComm As New SqlCommand
Dim ds As New DataSet
If myConn.State = ConnectionState.Closed Then
myConn.ConnectionString = ConfigurationManager.ConnectionStrings("NurProfileString").ConnectionString
End If
Dim drCertification As SqlDataReader
If myConn.State = ConnectionState.Closed Then
End If
DBComm.Connection = myConn
DBComm.CommandType = CommandType.StoredProcedure
DBComm.Parameters.Add("@EmpID", SqlDbType.Int).Value = Session("EmplNO")
DBComm.CommandText = "NurCerti_Log_Read" '
drCertification = DBComm.ExecuteReader()
dgCertification.DataSource = drCertification
drCertification = Nothing
Catch objError As Exception
Dim myarraylist As New ArrayList
MailHelper.SendMailMessage("", myarraylist, "", "", "Annual HR Employee Log Error ", "Nursing Profile Error")
Exit Try
End Try
End Sub

Posted: Mar 02, 2011 06:50 PM

View 3 Replies!   View Related
DataSource Controls :: Select Second Highest Record
I need the student details who secured thesecondhighest markin theMaths.

Posted: Dec 19, 2009 04:53 AM

View 3 Replies!   View Related
DataSource Controls :: Select Top Record From Sql Statement
If I run the following SQL script:


Posted: Mar 17, 2010 03:20 PM

View 3 Replies!   View Related
Javascript - Open A New Window With Specific Record Details From A Select Row ID In A Datagrid?
I have a gridview displaying all employees. Upon selecting an employee, I'd like to open a new page or window that would display all of the information for that employee with the option to edit/delete/update. Once this transaction is complete, return to previous page with gridview of all employees. ((language I'm usings is VB))

<asp:TemplateField Visible="true" headertext="Select">
<asp:HiddenField ID="hdID01" runat="server" Value='<%# Eval ("PersonnelID") %>' />


Posted: Dec 2 10 at 16:38

View 1 Replies!   View Related
DataSource Controls :: Modifying The Last Record Of A Filtered SELECT
I have a SQL data source control defined to filter data from a SQL database, sorted according to the date time in descending order. When i try and updatea field of thelatest record,the entire column, related to the fieldof the filtered searchgets modified. I want to only update a field ofthe last record i.e. the last entry of the filtered data. How can i achieve it?

Posted: Mar 04, 2011 05:43 PM

View 5 Replies!   View Related
DataSource Controls :: Select All Records Except 1 Record From A Table In SQL
I have to retreive all records from a table except 1 record. For example: I give example from default database in SQL ie "master" In "master" DB we have "spt_values" table. Now if I want to retreive all records from spt_values table except 1-1 record of type = A and type = B. To retreive all records its a simple query "Select * from spt_values where type in ('A','B')" -- this will returns 16 records. Now I want to retreive all record except 1-1 record left in each type, so it will return 14 records in result.

Posted: Jun 07, 2010 08:33 AM

View 6 Replies!   View Related
DataSource Controls :: How To Select And Delete Record In SqlDataSource
I have a sqlDatasource with aSelectParameter ControlParameter linked to a dropdownlistIs there an a way to select all records like *


So I can select records by year, but is there a value that will select all records for the @Year Parameter so I can display all records?

Posted: Apr 11, 2010 05:17 AM

View 3 Replies!   View Related
DataSource Controls :: Select Record Which Were Created In The Past 24 Hours
i have a table with the following columns; [Id] [CreatedDate] [Title] [Description] the data type for the column [CreatedDate] isDatetime. What i want to achieve is, i want a query that can retrieve records in that were created in the past 24 hours.

Posted: Jul 02, 2010 12:22 PM

View 5 Replies!   View Related
Forms Data Controls :: How To Filter Child Datagrid On Parent Datagrid Row Select
I have 2 grids gvParent & gvChild I would like to filter gvChild when a row is selected in gvParent the linking fields are contractNo

I added a column for selecting:

<asp:TemplateField ShowHeader="False">
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Select"
OnClick="LinkButton1_Click" Text="Select"></asp:LinkButton>

I know how to handle the filtering of the grid (create a criteria and set to rowfilter of the dataview) But, I dont know how to get the value of the column of the selected row.

Posted: Apr 06, 2010 10:53 PM

View 5 Replies!   View Related
Forms Data Controls :: Best Method To Bind SQL Datasource - Views For Show 50000 Record In Grid
I have 50000 record in two tables which need to show in grid? and the records in the table use to insert , update and delete frequently. I need to load fast all the records. which method i should bind to get as quick as early as possible. Which z best method to bind whether using SQL datasource, creating views, using datatable, creating stored procedure etc?

Posted: Nov 10, 2010 03:00 PM

View 8 Replies!   View Related
Forms Data Controls :: Want Users To Select A Record In The GridView And Then Have That Record Open Up In The Detailsview?
I want users to select a record in the GridView and then have that record open up in the Detailsview.How would I go aboutgetting these two tools to communicate?

Posted: Oct 06, 2010 07:44 PM

View 4 Replies!   View Related
DataSource Controls :: Insert New Record From GridView Row "Select" Command
I'm getting"Object reference not set to an instance of an object." on the first line of SQLdatasource1.Inserting event. Where is my code going wrong?





Posted: Nov 23, 2009 04:42 PM

View 13 Replies!   View Related
DataSource Controls :: Select A Record From A Table And Insert Into B Table Using Linq?
how can i select a record from A table and insert into B table using linq?

Posted: Jun 29, 2010 05:52 AM

View 2 Replies!   View Related
Forms Data Controls :: Gridview Will No Longer Show The Data - Datagrid Datasource = Null
I am familiar with populating a gridview with data. I am able to bind the Data pulled from the database into the gridview

gridview.DataSource = myDataTable;

If I write the following code, teh gridview will no longer show the data

gridview.DataSource = null;

My question is , I want to make the same thing with a user control that contain a gridview. when I use the user control in an aspx page, I am able to populate it with data, but when I try to make this code, the Datasource does not show, instead, I see .DV. So I tried this code but then , I do not see DataSource property instead I see DV(DataView), when I put .DV = null, I get an error message that the object is not in existed. any idea how to clear the user control gridview from its data.

Posted: Feb 25, 2011 05:14 AM

View 2 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 :: Send Email If Datagrid Row1 Count > 10?
On page I have gridView5 with 3 rows and 1 celsand i want to send email notification if row 1 on gridView5have value over "10"

Posted: Mar 02, 2010 09:53 AM

View 5 Replies!   View Related
Forms Data Controls :: Refresh Record Count From Database?
i have in my web-page `label` that contain result of count record query.

i need to see refresh this query and see the correct record count.

how to see it ? i need any timer ? how to do it without Flickers ?

can i get any sample C# code ?

Posted: Jan 31, 2011 05:50 PM

View 2 Replies!   View Related
Forms Data Controls :: Get Record Count From A Gridviews Sqldatasource After Filtering
I'm trying to get a row count from a Gridviews sqldatasource after filtering, but the count returns the value before filtering.

This filtering works but if I use e.AffectedRows shown below even after filtering it still shows the total rows returned before filtering.

FilterExpression="LastName Like '%{0}%' AND FirstName Like '%{1}%'"
<asp:ControlParameter ControlID="LastNameTextBox" DefaultValue="%" Name="LastName" PropertyName="Text" />
<asp:ControlParameter ControlID="FirstNameTextBox" DefaultValue="%" Name="FirstName" PropertyName="Text" />

To get the TOTAL records returned this works,but it is NOT the filteredrow count Protected Sub SqlDataSource1_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles sdsViewCMEs.Selected lblWarning.Text = e.AffectedRows & " rows returned" End Sub

Posted: Dec 23, 2008 08:25 PM

View 7 Replies!   View Related
How To Show No Record Found In GridView If Binded Datasource Is List Collection
I have a gridview in which dtasource binded is a List which returns class type. If no records in list, I want to display 'No records found' in GridView.


In else part, what code i have to write to get desired output?

Posted: Mar 11 at 12:52

View 3 Replies!   View Related
DataSource Controls :: Getting The PK ID Of The Newly Created Record After Inserting A New Record?
I am creating an album using the following stored procedure, which returns the primary key for the newly created record:

CREATE PROCEDURE [dbo].[fpa_sp_albums_update_insert]
@album_id int,
@album_name nvarchar (50),
@album_descr nvarchar(250),
@album_img_cover_id_FK int,
@album_creation_date date
If @album_id > 0
UPDATE [fpa_albums]
album_descr= @album_descr,
album_img_cover_id_FK = @album_img_cover_id_FK,
album_creation_date = @album_creation_date
Where ((album_id = @album_id))
INSERT INTO [fpa_albums] (

I execute the above stored procedure using the SQLHELPER. The VB.NET code for the page is as follows:


However, the createdAlbumID always shows -1 instead of the id for the newly created album.

Posted: Dec 20, 2010 12:10 AM

View 1 Replies!   View Related
Forms Data Controls :: Gridview Display Sub Select Statement Count?
the select statement for my gridview contains a sub select statement..that should allow users to see how many queries are associated with a particular can I get the queries column to display in my grid. As it is a count and not directly bound to any field

(SELECT COUNT(scriptID) FROM query WHERE scriptID = main.scriptID) AS queries.......

Posted: Feb 14, 2011 02:55 PM

View 2 Replies!   View Related
Forms Data Controls :: Displaying Details Of Record IDs In A DataGrid?
I have a series of record IDs in an array that I pass to a DataGrid for Data Binding I want to show the details of each record ID in every row of the datagrid, for exampleI canput a detailsview in the itemtemplate of the datagrid anduse an objectdatasource's select method for retrieving the information for a specific record ID but how to pass these record IDs to objectdatasource? is this a correct example and howcan I implement this?

Posted: Feb 18, 2010 05:49 PM

View 3 Replies!   View Related
Web Forms :: Select 3 Record For DB - Won't Enter Every Record In Label Or Textbox
I was Make code to select top 3 record from db and I wont to enter everyrecord in label or textbox


Posted: Mar 15, 2011 08:07 PM

View 6 Replies!   View Related
Forms Data Controls :: Implement A Datagrid With The Possibility To Update A Record
i am using asp net 2.0 and mysql. I need to implement a datagrid with the possibility to update a record but i am having problems and i don't know why.

this is the code:


the primary key of the table is a composed key fot IdOrdine and IdMezzo.

Posted: Jul 22, 2010 09:20 AM

View 3 Replies!   View Related
Forms Data Controls :: DataGrid Or Grid-like Control For Record Selection?
I would like to ask if there is any control act like grid to display records.The 'datasource' will be a customed class, this dataclass has List<T>, so I will populate each element by iteration into the grid.Any control can I use to work like a grid?The number of records will around 100.This control should also allow the user to select a record.

Posted: Feb 20, 2011 10:05 PM

View 2 Replies!   View Related
VS 2005 - Getting Record Count
mySqlCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@RecordCount", Data.SqlDbType.Int))
mySqlCommand.Parameters("@RecordCount").Direction = Data.ParameterDirection.Output
mySqlCommand.CommandType = Data.CommandType.StoredProcedure
mySqlCommand.CommandText = ("sp_ZyTax_Get_Record_Count_jTable")
mySqlCommand.Connection = mySqlConnection
Return myRecordCount = mySqlCommand.Parameters("@RecordCount").Value
Stored Procedure:

@RecordCount int output
set nocount on
select count(*) from ZyTax.dbo.jTable
set @RecordCount = @@ROWCOUNT

Posted: Sep 11th, 2009, 12:14 PM

View 12 Replies!   View Related
Web Forms :: Record Count In C#?
I would like to know the sintax to count the number of records that match a certain criteria from the database. For example, I have this;

// all connections

string MyConnString = Select * from Table1 Where UserName = '" + Page.User.Identity.Name + "'";

while (DReader.Read())
int count = count + 1;

Is there a more efficient way that actually works correctly? My code is having some problems. By the way I'm using access.

Posted: Jun 27, 2008 09:43 PM

View 5 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;
lblMsg.Text = "Customer List Is Empty";

Posted: Aug 06, 2010 01:37 AM

View 2 Replies!   View Related
C# - How To Refresh Record Count From Database
i have in my web-page label that contain result of count record query.

i need to see refresh this query and see the correct record count.

how to see it ? i need any timer ? how to do it without Flickers ?

can i get any sample C# code ?

Posted: Jan 31 at 18:50

View 2 Replies!   View Related
Find The Count Of Record In A Database?
I have a database where the first six letters can be "buffal" or "washin" or any other combination. But there could bemany of one combination example:

buffal01, buffal02, buffal03...buffal98 and so on. I can find all of the record using SELECT * FROM RecordName WHERE (Record LIKE 'buffal%') ORDER BY DESC

How can I get the number of records LIKE buffal% so that I canassign that number to my count to get the next high number?

Posted: Nov 18, 2008 02:28 PM

View 10 Replies!   View Related
Web Forms :: Get A Record Count From A SqlDatSource?
My SqlDataSource looks like this:

<asp:SqlDataSource ID="SDSResourceCount" runat="server"
ConnectionString="<%&#36; ConnectionStrings:wapConnectionString %>"


Posted: Aug 19, 2009 12:58 AM

View 10 Replies!   View Related
DataSource Controls :: Programmatically Setting ODS Select Method And Select Parameters?
The drop down list is used to determine what search criteria will be used to find an invoice. I tried to set the Select method in the switch statement. I don't understand how to set the Select Method and the select parameters programmatically though . I tried a few different ways but can't make the compiler happy. My ODS is in scope in the code behind. I'm not able to access it's properties though. The BAL resides in a separate project that is a ClassLibrary. I also have a using statement for the ClassLibrary project in the code behind.

give me an example of how to do this?

Mark up:





Posted: Dec 22, 2010 04:55 PM

View 1 Replies!   View Related
Copyright 2005-08, All rights reserved