CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 Count the number of rows added to the database.

Print topic Send  topic

Author Message
kescott


Posts: 49
Posted: 11/03/2008, 3:09 PM

How do I count the number of rows I added to my database? I'm have trouble compiling in CodeCharge. For some reason Console.WriteLine() method has no effect.

:)

I was thinking I could do the following:

//----  
string connectionString = GetConnectionString();  
using (SqlConnection sourceConnection = new SqlConnection(connectionString))  
{  
sourceConnection.Open();  
  
SqlCommand commandRowCount = new SqlCommand(  
"SELECT COUNT(*) FROM Employees;", sourceConnection);  
  
long countStart = System.Convert.ToInt32(  
commandRowCount.ExecuteScalar());  
  
Console.WriteLine("Starting row count = {0}", countStart);  
  
long countEnd = System.Convert.ToInt32(  
commandRowCount.ExecuteScalar());  
Console.WriteLine("Ending row count = {0}", countEnd);  
Console.WriteLine("{0} rows were added.", countEnd - countStart);  
//-----
O:) O:)
_________________
B.S. of Computer Science
Class of 2005
Norfolk State University
Norfolk, VA
http://www.nsu.edu
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.