473,756 Members | 4,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data display?

Hi guys,

I've got a DB table of timecards with these fields in the table:

ID (Int)
UserID (Int)
DateWorked (DateTime)
HoursWorkedOnTh atDate (Double)

I'd like to display a grid, with Monday - Sunday across the top (in columns)
and the users in rows vertically. I am not conceptually aware of a way to do
this. The biggest question is msut I query the same data 7 times? (For Each
day?) I would hope I could quiery once with the date bounds to get a
resultset with the 7 day range, and then somehow get the data in place. I was
thinking of applying a filter after this step to the resultset via a custom
dataview that I could change 7 times. Would a datagrid fit the job? If it
came down to it, I could enumerate through the resultset and for each value
increment a certain cell, but that seems cumbersome and I would hope I could
do this via databinding. Any help would be very helpful.

Thanks!

-Ben
May 10 '06 #1
9 1954
Hi, I'm not sure if the solutions you mentioned are usable from within an
ASP.NET 2.0 page. Are they? Also, could you elaborate on how a "subquery"
would fit into this?

Thanks...

-Ben

"Spam Catcher" wrote:
=?Utf-8?B?QmVuIFIu?= <be**@newsgroup .nospam> wrote in
news:D2******** *************** ***********@mic rosoft.com:
I've got a DB table of timecards with these fields in the table:

ID (Int)
UserID (Int)
DateWorked (DateTime)
HoursWorkedOnTh atDate (Double)

I'd like to display a grid, with Monday - Sunday across the top (in
columns) and the users in rows vertically. I am not conceptually aware
of a way to do this. The biggest question is msut I query the same
data 7 times? (For Each day?) I would hope I could quiery once with
the date bounds to get a resultset with the 7 day range, and then
somehow get the data in place.


You could use a subquery to calculate the data.

To display the data you could use a grid or perhaps a reporting solution
like Crystal, ActiveReports, XtraReports, or Reporting Services.

May 10 '06 #2
This type of display is generally referred to as a Crosstab report.
Crystal reports has a Crosstab wizard. Excel calls it a PivotTable.

It's only really difficult when you have an unknown number of columns
to display. Wince you have a fixed number of columns you can do this
one of many ways:

1. Use the crosstab query functions in SQL Server 2005 if you're using
it.
2. Query the table "as-is" and then build a dataset in memory.
Manully construct the columns of the dataset and fill them with sums
you calculate off of the query results.
3. Build a query where you join the timecards table 7 times with a
join on clause specifying a different day of the week for each join.
In the select list, select the sum of hours by employee from each of
the seven joined tables and name them hours_mon, hours_tue, etc.

John H.

May 10 '06 #3
Hi John,

I'm very interested in the 2nd and 3rd suggestions you gave. For the dataset
suggestion, would I start by using a dataadapter to pull the current table
into a dataset and then perform modifications to that data? Or what would you
suggest?

And for the multiple query suggestion, I was hoping you could elaborate some
more. In either example, if you could point me to some reading (if any exists
that you know of), that would be very helpful.

Thanks...

-Ben

"JohnH" wrote:
This type of display is generally referred to as a Crosstab report.
Crystal reports has a Crosstab wizard. Excel calls it a PivotTable.

It's only really difficult when you have an unknown number of columns
to display. Wince you have a fixed number of columns you can do this
one of many ways:

1. Use the crosstab query functions in SQL Server 2005 if you're using
it.
2. Query the table "as-is" and then build a dataset in memory.
Manully construct the columns of the dataset and fill them with sums
you calculate off of the query results.
3. Build a query where you join the timecards table 7 times with a
join on clause specifying a different day of the week for each join.
In the select list, select the sum of hours by employee from each of
the seven joined tables and name them hours_mon, hours_tue, etc.

John H.

May 10 '06 #4
Lets say your timecards table is called timecards and your list of
users is in a table called users. Your query for suggestion 3 would
look like this:

select u.UserID, u.UserName,
SUM(tc1.Hours) as mon, SUM(tc2.Hours) as tue,
SUM(tc3.Hours) as wed, SUM(tc4.Hours) as thu, SUM(tc5.Hours) as fri
from users u
inner join timecards tc1 on tc1.UserID = u.UserID and tc1.DateWorked =
'1/1/2006'
inner join timecards tc2 on tc2.UserID = u.UserID and tc2.DateWorked =
'1/2/2006'
inner join timecards tc3 on tc3.UserID = u.UserID and tc3.DateWorked =
'1/3/2006'
inner join timecards tc4 on tc4.UserID = u.UserID and tc4.DateWorked =
'1/4/2006'
inner join timecards tc5 on tc5.UserID = u.UserID and tc5.DateWorked =
'1/5/2006'
group by u.UserID, u.UserName

You'd need to set the actual dates for the week you are interested in
for the join clauses.

I suggestion 2, yes you could use a DataReader or a DataAdapter to get
the data, and you can put it into a dataset (generic or strongly typed)
as you please. However, once the data is retrieved, it is still in the
form:

UserID, DateWorked, HoursWorkedOnTh atDate

So now you want to create a new DataSet and add a new DataTable to it.
Manually add 6 (or 8 if you count weekends) DataColumns to the table -
the first column is the user and the other 5 (or 7) columns will
contain the hours for that user for each day. Now loop over the users
in your raw data. For each user, add a new DataRow to the DataTable
and set the first column value to the user id. Next, within the user
loop, loop over your 5 (or 7) dates and add up the hours (in memory,
using your raw data that you have already retrieved from the database)
for that user for each of the days and set the appropriate column of
the DataRow to the number of hours. Finally, bind your datagrid to
this new DataSet.

I don't have time right now to do a code example that's specific for
your case. However, below is an example of the same thing but more
generalized for any number of columns. In this example, your "users"
are my "limits", your "days" are my "samples", and your "hours" are my
"results" (although I'm doing some other stuff like comparing the
result in each cell of the matrix to a predefined limit value). The
main logic is in the CompareCrossTab method, where I create a new
DataSet, add a DataTable with the appropriate columns, then loop
through and add DataRows.

HTH,

John H.
== Example Code - Crosstab.cs ==

using System;
using System.Collecti ons;
using System.Data;
using System.Data.Sql Client;

using mystuff.common;

namespace mystuff.crossta b
{
public class Crosstab
{
public Crosstab()
{
}

public DataSet CompareCrossTab (SqlConnection conn, ArrayList
samplePKs, int limitTypeId)
{
DataSet ds = CreateEmptyComp areDataSet(samp lePKs);
DataTable dt = ds.Tables["compare"];

if (conn.State != ConnectionState .Open)
conn.Open();

SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;

ArrayList limits = GetLimits(cmd, limitTypeId);

foreach (LimitInfo li in limits)
{
DataRow dr = dt.NewRow();
SetLimitColumns (dr, li);

foreach (SamplePK sample in samplePKs)
{
AddSampleData(c md, dr, li, sample);
}

dt.Rows.Add(dr) ;
}

return ds;
}

private DataSet CreateEmptyComp areDataSet(Arra yList samplePKs)
{
DataSet ds;
DataTable dt;
DataColumn dc;

ds = new DataSet();
dt = new DataTable("comp are");

dc = new DataColumn("mat rix", Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

dc = new DataColumn("ana lyte_class", Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

dc = new DataColumn("ana lyte", Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

dc = new DataColumn("cas _number", Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

dc = new DataColumn("ope rator", Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

dc = new DataColumn("lim it", Type.GetType("S ystem.Decimal") );
dt.Columns.Add( dc);

dc = new DataColumn("lim it_units", Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

foreach (SamplePK sample in samplePKs)
{
string colName;

colName = sample.SampleID + "|" +
sample.SampleDa te.ToShortDateS tring() + "|R";
dc = new DataColumn(colN ame, Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

colName = sample.SampleID + "|" +
sample.SampleDa te.ToShortDateS tring() + "|U";
dc = new DataColumn(colN ame, Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

colName = sample.SampleID + "|" +
sample.SampleDa te.ToShortDateS tring() + "|Q";
dc = new DataColumn(colN ame, Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);
}
ds.Tables.Add(d t);

return ds;
}

private ArrayList GetLimits(SqlCo mmand cmd, int limitTypeId)
{
ArrayList limits = new ArrayList();

string sql;
sql = "SELECT analyte, matrix, analyte_class, cas_number, operator,
limit, limit_units ";
sql += "FROM limits ";
sql += "WHERE limit_type_id = " + limitTypeId + " ";
sql += "AND limit IS NOT NULL ";
sql += "AND cas_number IS NOT NULL ";
sql += "ORDER BY matrix, analyte_class, analyte";

cmd.CommandText = sql;
SqlDataReader rdr = cmd.ExecuteRead er();
while (rdr.Read())
{
LimitInfo li = new LimitInfo();
li.analyte = rdr.GetString(0 );
li.matrix = rdr.GetString(1 );
li.analyteClass = rdr.GetString(2 );
li.casNum = rdr.GetString(3 );
li.op = rdr.GetString(4 );
li.limit = rdr.GetDecimal( 5);
li.units = rdr.GetString(6 );
limits.Add(li);
}
rdr.Close();

return limits;
}

private void SetLimitColumns (DataRow dr, LimitInfo li)
{
dr["matrix"] = li.matrix;
dr["analyte_cl ass"] = li.analyteClass ;
dr["analyte"] = li.analyte;
dr["cas_number "] = li.casNum;
dr["operator"] = li.op;
dr["limit"] = li.limit;
dr["limit_unit s"] = li.units;
}

private void AddSampleData(S qlCommand cmd, DataRow dr, LimitInfo li,
SamplePK sample)
{
string sql;
sql = "SELECT result_text, qualifier_combi ned, units, PQL_text ";
sql += "FROM lab_results ";
sql += "INNER JOIN matrix_xref ON matrix_xref.lab _matrix =
lab_results.mat rix ";
sql += "WHERE field_sample_id = '" +
AppUtils.Encode ForDB(sample.Sa mpleID) + "' ";
sql += "AND collection_date = '" +
sample.SampleDa te.ToShortDateS tring() + "' ";
sql += "AND limit_matrix = '" + AppUtils.Encode ForDB(li.matrix ) +
"' ";
sql += "AND cas_number = '" + AppUtils.Encode ForDB(li.casNum ) +
"' ";
sql += "AND QAQC_type IS NULL ";
sql += "AND surrogate_compo und IS NULL ";
cmd.CommandText = sql;

SqlDataReader rdr = cmd.ExecuteRead er();
if (rdr.Read())
{
string resultText = "";
if (!(rdr.IsDBNull (0)))
resultText = rdr.GetString(0 );

string qualifierCombin ed = "";
if (!(rdr.IsDBNull (1)))
qualifierCombin ed = rdr.GetString(1 );

string resultUnits = rdr.GetString(2 );

string pqlText = "";
if (!(rdr.IsDBNull (0)))
pqlText = rdr.GetString(3 );

string colValue = "";
if (qualifierCombi ned.ToUpper().I ndexOf("U") != -1)
colValue = "< " + pqlText;
else
colValue = resultText;

string colName;
colName = sample.SampleID + "|" +
sample.SampleDa te.ToShortDateS tring() + "|R";
dr[colName] = colValue;
colName = sample.SampleID + "|" +
sample.SampleDa te.ToShortDateS tring() + "|U";
dr[colName] = resultUnits;
colName = sample.SampleID + "|" +
sample.SampleDa te.ToShortDateS tring() + "|Q";
dr[colName] = qualifierCombin ed;
}
rdr.Close();
}

private string GetList(ArrayLi st a)
{
if (a.Count == 0)
return "";

string s = "(";
foreach (string id in a)
{
s += "'" + id + "',";
}
s = s.Substring(0, s.Length - 1) + ")";
return s;
}
}

public class ColumnInfo
{
public string fieldSampleId;
public DateTime sampleDate;
}

public class LimitInfo
{
public string analyte;
public string matrix;
public string analyteClass;
public string casNum;
public string op;
public decimal limit;
public string units;
}
}

May 10 '06 #5
Thanks, John. That was a very helpful response. It made me really gain a
better understanding of SQL joins and other circumstances where they can be
used.

Would there be any reason for one to use either of these methods above the
other? It seems like the first method requires less effort on the user's
part. Is there a performance difference between the two that you know of?

Also, out of curiosity, why do you suggest creating a brand new dataset
rather than adding a new datatable to the already existing dataset for the
datatable that we generate and bind to?

Thanks again for the great info...

-Ben

"JohnH" wrote:
Lets say your timecards table is called timecards and your list of
users is in a table called users. Your query for suggestion 3 would
look like this:

select u.UserID, u.UserName,
SUM(tc1.Hours) as mon, SUM(tc2.Hours) as tue,
SUM(tc3.Hours) as wed, SUM(tc4.Hours) as thu, SUM(tc5.Hours) as fri
from users u
inner join timecards tc1 on tc1.UserID = u.UserID and tc1.DateWorked =
'1/1/2006'
inner join timecards tc2 on tc2.UserID = u.UserID and tc2.DateWorked =
'1/2/2006'
inner join timecards tc3 on tc3.UserID = u.UserID and tc3.DateWorked =
'1/3/2006'
inner join timecards tc4 on tc4.UserID = u.UserID and tc4.DateWorked =
'1/4/2006'
inner join timecards tc5 on tc5.UserID = u.UserID and tc5.DateWorked =
'1/5/2006'
group by u.UserID, u.UserName

You'd need to set the actual dates for the week you are interested in
for the join clauses.

I suggestion 2, yes you could use a DataReader or a DataAdapter to get
the data, and you can put it into a dataset (generic or strongly typed)
as you please. However, once the data is retrieved, it is still in the
form:

UserID, DateWorked, HoursWorkedOnTh atDate

So now you want to create a new DataSet and add a new DataTable to it.
Manually add 6 (or 8 if you count weekends) DataColumns to the table -
the first column is the user and the other 5 (or 7) columns will
contain the hours for that user for each day. Now loop over the users
in your raw data. For each user, add a new DataRow to the DataTable
and set the first column value to the user id. Next, within the user
loop, loop over your 5 (or 7) dates and add up the hours (in memory,
using your raw data that you have already retrieved from the database)
for that user for each of the days and set the appropriate column of
the DataRow to the number of hours. Finally, bind your datagrid to
this new DataSet.

I don't have time right now to do a code example that's specific for
your case. However, below is an example of the same thing but more
generalized for any number of columns. In this example, your "users"
are my "limits", your "days" are my "samples", and your "hours" are my
"results" (although I'm doing some other stuff like comparing the
result in each cell of the matrix to a predefined limit value). The
main logic is in the CompareCrossTab method, where I create a new
DataSet, add a DataTable with the appropriate columns, then loop
through and add DataRows.

HTH,

John H.
== Example Code - Crosstab.cs ==

using System;
using System.Collecti ons;
using System.Data;
using System.Data.Sql Client;

using mystuff.common;

namespace mystuff.crossta b
{
public class Crosstab
{
public Crosstab()
{
}

public DataSet CompareCrossTab (SqlConnection conn, ArrayList
samplePKs, int limitTypeId)
{
DataSet ds = CreateEmptyComp areDataSet(samp lePKs);
DataTable dt = ds.Tables["compare"];

if (conn.State != ConnectionState .Open)
conn.Open();

SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;

ArrayList limits = GetLimits(cmd, limitTypeId);

foreach (LimitInfo li in limits)
{
DataRow dr = dt.NewRow();
SetLimitColumns (dr, li);

foreach (SamplePK sample in samplePKs)
{
AddSampleData(c md, dr, li, sample);
}

dt.Rows.Add(dr) ;
}

return ds;
}

private DataSet CreateEmptyComp areDataSet(Arra yList samplePKs)
{
DataSet ds;
DataTable dt;
DataColumn dc;

ds = new DataSet();
dt = new DataTable("comp are");

dc = new DataColumn("mat rix", Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

dc = new DataColumn("ana lyte_class", Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

dc = new DataColumn("ana lyte", Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

dc = new DataColumn("cas _number", Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

dc = new DataColumn("ope rator", Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

dc = new DataColumn("lim it", Type.GetType("S ystem.Decimal") );
dt.Columns.Add( dc);

dc = new DataColumn("lim it_units", Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

foreach (SamplePK sample in samplePKs)
{
string colName;

colName = sample.SampleID + "|" +
sample.SampleDa te.ToShortDateS tring() + "|R";
dc = new DataColumn(colN ame, Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

colName = sample.SampleID + "|" +
sample.SampleDa te.ToShortDateS tring() + "|U";
dc = new DataColumn(colN ame, Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);

colName = sample.SampleID + "|" +
sample.SampleDa te.ToShortDateS tring() + "|Q";
dc = new DataColumn(colN ame, Type.GetType("S ystem.String")) ;
dt.Columns.Add( dc);
}
ds.Tables.Add(d t);

return ds;
}

private ArrayList GetLimits(SqlCo mmand cmd, int limitTypeId)
{
ArrayList limits = new ArrayList();

string sql;
sql = "SELECT analyte, matrix, analyte_class, cas_number, operator,
limit, limit_units ";
sql += "FROM limits ";
sql += "WHERE limit_type_id = " + limitTypeId + " ";
sql += "AND limit IS NOT NULL ";
sql += "AND cas_number IS NOT NULL ";
sql += "ORDER BY matrix, analyte_class, analyte";

cmd.CommandText = sql;
SqlDataReader rdr = cmd.ExecuteRead er();
while (rdr.Read())
{
LimitInfo li = new LimitInfo();
li.analyte = rdr.GetString(0 );
li.matrix = rdr.GetString(1 );
li.analyteClass = rdr.GetString(2 );
li.casNum = rdr.GetString(3 );
li.op = rdr.GetString(4 );
li.limit = rdr.GetDecimal( 5);
li.units = rdr.GetString(6 );
limits.Add(li);
}
rdr.Close();

return limits;
}

private void SetLimitColumns (DataRow dr, LimitInfo li)
{
dr["matrix"] = li.matrix;
dr["analyte_cl ass"] = li.analyteClass ;
dr["analyte"] = li.analyte;
dr["cas_number "] = li.casNum;
dr["operator"] = li.op;
dr["limit"] = li.limit;
dr["limit_unit s"] = li.units;
}

private void AddSampleData(S qlCommand cmd, DataRow dr, LimitInfo li,
SamplePK sample)
{
string sql;
sql = "SELECT result_text, qualifier_combi ned, units, PQL_text ";
sql += "FROM lab_results ";
sql += "INNER JOIN matrix_xref ON matrix_xref.lab _matrix =
lab_results.mat rix ";
sql += "WHERE field_sample_id = '" +
AppUtils.Encode ForDB(sample.Sa mpleID) + "' ";
sql += "AND collection_date = '" +
sample.SampleDa te.ToShortDateS tring() + "' ";
sql += "AND limit_matrix = '" + AppUtils.Encode ForDB(li.matrix ) +
"' ";
sql += "AND cas_number = '" + AppUtils.Encode ForDB(li.casNum ) +
"' ";
sql += "AND QAQC_type IS NULL ";
sql += "AND surrogate_compo und IS NULL ";
cmd.CommandText = sql;

SqlDataReader rdr = cmd.ExecuteRead er();
if (rdr.Read())
{
string resultText = "";
if (!(rdr.IsDBNull (0)))
resultText = rdr.GetString(0 );

string qualifierCombin ed = "";
if (!(rdr.IsDBNull (1)))
qualifierCombin ed = rdr.GetString(1 );

string resultUnits = rdr.GetString(2 );

string pqlText = "";
if (!(rdr.IsDBNull (0)))
pqlText = rdr.GetString(3 );

string colValue = "";
if (qualifierCombi ned.ToUpper().I ndexOf("U") != -1)
colValue = "< " + pqlText;
else
colValue = resultText;

string colName;
colName = sample.SampleID + "|" +
sample.SampleDa te.ToShortDateS tring() + "|R";
dr[colName] = colValue;
colName = sample.SampleID + "|" +
sample.SampleDa te.ToShortDateS tring() + "|U";
dr[colName] = resultUnits;
colName = sample.SampleID + "|" +
sample.SampleDa te.ToShortDateS tring() + "|Q";
dr[colName] = qualifierCombin ed;
}
rdr.Close();
}

private string GetList(ArrayLi st a)
{
if (a.Count == 0)
return "";

string s = "(";
foreach (string id in a)
{
s += "'" + id + "',";
}
s = s.Substring(0, s.Length - 1) + ")";
return s;
}
}

public class ColumnInfo
{
public string fieldSampleId;
public DateTime sampleDate;
}

public class LimitInfo
{
public string analyte;
public string matrix;
public string analyteClass;
public string casNum;
public string op;
public decimal limit;
public string units;
}
}

May 11 '06 #6
Hi Ben,

I think the #1 suggestion from John will mostly rely on the backend
database server, so if there is no much concerns on the flexibility of the
backend database, that'll be good. As for #2 which load all the datatables
separately into our ASP.NET application's memory (in a single dataset),
that'll make it easy to manipulate the unformated data in our application
layer's code(especially when there is any manipulation or formatting that
can not be done at database layer). However, caching large object like
dataset in ASP.NET memory is very expensive, you would also consider this
according to your server machine's condition.

Regards,

Steven Cheng
Microsoft Online Community Support
=============== =============== =============== =====

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 12 '06 #7
The first method (using a multi-join query) is the easiest and probably
the better choice when you know the number of columns ahead of time.
It is harder to program a true crosstab query this way, where the
number of columns is variable.

There's no particular reason why I said to use a new dataset. In my
code example, you'll see I actually use SqlDataReaders to get the data
out of the database - they are much faster for read-only data
extraction than DataAdapters and DataSets.

Glad I could help,

John H.

May 12 '06 #8
Thanks John and Steven!

-Ben

"JohnH" wrote:
The first method (using a multi-join query) is the easiest and probably
the better choice when you know the number of columns ahead of time.
It is harder to program a true crosstab query this way, where the
number of columns is variable.

There's no particular reason why I said to use a new dataset. In my
code example, you'll see I actually use SqlDataReaders to get the data
out of the database - they are much faster for read-only data
extraction than DataAdapters and DataSets.

Glad I could help,

John H.

May 18 '06 #9
Hi John,

I'm going the dataset route as access doesn't seem to be too keen on that
level of complexity in joins. Anyway, I'm curious as to why it makes more
sense to fill a datatable and then contsruct a new datatable from the first
one. Why not just create a datatable based off of a datareader? To be honest,
I'm not too familiar with the other method of accessing data through a data
table. I'm more used to a forward-only cursor. I invision enumerating through
the datareader and for each entry saying something like,

"If username doens't already have a datarow, create one. Now, add hours to
the appropriate column."

So it would create the row if necessary, and then in either case, would add
the hours. Is there a way to do this type of check? it would avoid the need
to enumerate through the datasource adding all the rows and then re-enumerate
through to add hours.

I guess I'm just not sure of how to enumerate through a datasource which
gives you this level of flexibility. My mental model has always invovled
working around the narrow confines of a foreward only cursor and not a random
access model. Any thoughts?

-Ben

"JohnH" wrote:
The first method (using a multi-join query) is the easiest and probably
the better choice when you know the number of columns ahead of time.
It is harder to program a true crosstab query this way, where the
number of columns is variable.

There's no particular reason why I said to use a new dataset. In my
code example, you'll see I actually use SqlDataReaders to get the data
out of the database - they are much faster for read-only data
extraction than DataAdapters and DataSets.

Glad I could help,

John H.

May 25 '06 #10

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

Similar topics

3
2162
by: StepH | last post by:
Hi, I'm building a little application, which the goal is to: 1./ Collect data via Serial line and or via a file (for playback). 2./ Display these data as graph, oscilloscope, ... How manage this ? 1./ Is each "display" must responsible to acquire/read the data ?
9
2358
by: Susan Bricker | last post by:
Greetings. I am having trouble populating text data that represents data in my table. Here's the setup: There is a People Table (name, address, phone, ...) peopleID = autonumber key There is a Judge Table (information about judges) judgeID = autonumber key
1
2783
by: JK | last post by:
In my win form, I'm trying to display a Crystal report with the data in my dataset only but, if I follow the steps in this msdn page: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/crystlmn/html/crtsksettingupanado.netreportinaviewer.asp it always displays all the data regardless of the Select statement I run. Here's my code: InitializeComponent(); //my code
2
12561
by: Matt | last post by:
When we submit the form data to another page, we usually do the following: <form action="display.aspx" method="post"> will submit the form data and open display.asp in the current browser <form action="display.aspx" method="post" target="_blank"> will submit the form data and open display.asp in a new browser
1
1229
by: epigram | last post by:
I'd like to know if there is a best approach, in terms of using the Data Web Controls (i.e. DataGrid, DataList & Repeater), for displaying data that is the result of a query that joins two tables that have a one-to-many relationship. For instance if I perform a query on two such tables, I might expect that there would be data repeated on multiple rows from table on the one side of the relationship. What I want to do is display an HTML...
5
2666
by: Kent Boogaart | last post by:
Hi, I have some hierarchical data (FAQs) that I would like to bind to. The basic structure is: FAQ Category + Categories + FAQs So an FAQ category has any number of sub-categories and any number of FAQs.
2
2469
by: x | last post by:
hi i am a pilot by profession. i want to create a database of my logbook using ms access 2002. i am facing a problem regarding the format of time field. when i select "Data/Time" data type for my time field then this format gives the liberty to record times uptill a figure of 59 in different sub-formats, whereas i want the format to be able to record the times like 80:35 or 1:10 or 1138:00. which means that i have these many hours on a...
0
14421
by: Grip | last post by:
Hi, I have gone throught the group and Microsoft's online help and have seen many suggestions but I am still seeking clarity: 1. I have an excel spreadsheet. Column A contains text that may be greater than 255 characters. 2. I have an access database. I link (not import) to the contents of the excel spreadsheet. In the design view in access, Column A has the data type "memo".
4
2069
by: seth_hickel | last post by:
With other solutions I would get a recordset, read each record and display data by formating my html as I wanted to display values of each record. I am trying to display data in a three column three row table with paging. How does this translate to ASP.NET - or - what ASP.NET tools do I use to accomplish this and how. Thank you.
7
28901
Merlin1857
by: Merlin1857 | last post by:
Its great producing data for users to look at in your web pages and generally that is sufficient for their needs but sometimes you may want to supply your user with the data in a form they can actually do something more with. This code shows you how to display data from your database and then how to give that data to the user in the form of a useable Excel spreadsheet which they can then take away and play with themselves. The way I have shown...
0
9487
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9904
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9735
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8736
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.