Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: ASP.Net RecordCount


Message #1 by "Steve White" <srw.ict@b...> on Tue, 12 Mar 2002 09:44:17
Does anyone here know how to implement a simple recordcount, Im using 

VB.Net code behind. It was easy with standard ASP :D



Thx V.much



Steve
Message #2 by "Sachin M" <sachinx@h...> on Tue, 12 Mar 2002 20:27:58 +0530
Here is some C# code for you



SqlConnection sqlConnection = new SqlConnection(m_ConnectionString);

SqlDataAdapter sqlAdapter1 = new SqlDataAdapter("SELECT CustomerName FROM 

Accounts WHERE CustomerName='"+customerName+"'", sqlConnection);



          DataSet accountDetails = new DataSet();

          sqlAdapter1.Fill(accountDetails, "accountDetails");



          if (accountDetails.Tables[0].Rows.Count < 1) {

            return false;

          }

		  else

		  	return true;





>From: "Steve White" <srw.ict@b...>

>Reply-To: "aspx_beginners" <aspx_beginners@p...>

>To: "aspx_beginners" <aspx_beginners@p...>

>Subject: [aspx_beginners] ASP.Net RecordCount

>Date: Tue, 12 Mar 2002 09:44:17

>

>Does anyone here know how to implement a simple recordcount, Im using

>VB.Net code behind. It was easy with standard ASP :D

>

>Thx V.much

>

>Steve




>$subst('Email.Unsub').









_________________________________________________________________

Join the world?s largest e-mail service with MSN Hotmail. 

http://www.hotmail.com



Message #3 by "Siva Mateti" <sivamvs@y...> on Fri, 22 Mar 2002 04:09:49
> Does anyone here know how to implement a simple recordcount, Im using 
> VB.Net code behind. It was easy with standard ASP :D
> 
> Thx V.much
> 
> Steve
Message #4 by "Siva Mateti" <sivamvs@y...> on Fri, 22 Mar 2002 04:20:55
Try the following code:  (in the myscalarquery, use "count(*)" )

    SqlCommand myCommand = new SqlCommand(myScalarQuery, myConnection);
    myCommand.Connection.Open();
    Int count = (int) myCommand.ExecuteScalar();
    myConnection.Close();

Hope this helps


> Does anyone here know how to implement a simple recordcount, Im using 
> VB.Net code behind. It was easy with standard ASP :D
> 
> Thx V.much
> 
> Steve

  Return to Index