CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
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.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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