|
 |
aspx_beginners thread: Query RecordCount
Message #1 by "Satish Katika" <satishkatika@r...> on 24 Feb 2002 12:46:43 -0000
|
|
void Page_Load(Object S, EventArgs E)=0A{=0ASqlConnection c=3Dnew SqlConnec
tion("Provider.....");=0Ac.Open();=0ASqlCommand co1=3Dnew SqlCommand(Select
* From Table1,c);=0ADataGrid1.DataSource=3Dco1.ExecuteReader();=0ADataGrid
1.DataBind();=0Ac.Close();=0A}=0A=0AIN the above code i can get the data in
datagrid NAmed DataGrid1, But i just want to know the Number of Records Fo
und, so that i can verify the username and password ie. valid or not.=0Aie.
if records is non zero the user is valid if zero its valid.=0A=0ACan you s
uggest me how can i get the RecordCount in asp.net.=0A=0ASatish Katika.=0A
=0A =0A
Message #2 by "worleys" <worleys@h...> on Mon, 25 Feb 2002 04:38:57 -0800
|
|
Okay am very tired but a quick and dirty change to yourcode below would
be as follows
void Page_Load(Object S, EventArgs E)
{
SqlConnection c=new SqlConnection("Provider.....");
c.Open();
SqlCommand co1=new SqlCommand(Select count(*) From Table1,c);
DataGrid1.DataSource=co1.ExecuteReader();
DataGrid1.DataBind();
c.Close();
}
This will return the total number of row in the table the select command
returns.
Hth
Scott Worley
-----Original Message-----
From: Satish Katika [mailto:satishkatika@r...]
Sent: Sunday, February 24, 2002 4:47 AM
To: aspx_beginners
Subject: [aspx_beginners] Query RecordCount
void Page_Load(Object S, EventArgs E)
{
SqlConnection c=new SqlConnection("Provider.....");
c.Open();
SqlCommand co1=new SqlCommand(Select * From Table1,c);
DataGrid1.DataSource=co1.ExecuteReader();
DataGrid1.DataBind();
c.Close();
}
IN the above code i can get the data in datagrid NAmed DataGrid1, But i
just want to know the Number of Records Found, so that i can verify the
username and password ie. valid or not. ie. if records is non zero the
user is valid if zero its valid.
Can you suggest me how can i get the RecordCount in asp.net.
Satish Katika.
---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to
$subst('Email.Unsub').
Message #3 by "worleys" <worleys@h...> on Mon, 25 Feb 2002 04:41:45 -0800
|
|
Arrgghhh, told you I was tired, just to check you state you just want to
check the password and user, if so why are you putting results into a
datagrid, I appologize, if I am missing the obvious, its very early
morning here ;)
Scott
-----Original Message-----
From: Satish Katika [mailto:satishkatika@r...]
Sent: Sunday, February 24, 2002 4:47 AM
To: aspx_beginners
Subject: [aspx_beginners] Query RecordCount
void Page_Load(Object S, EventArgs E)
{
SqlConnection c=new SqlConnection("Provider.....");
c.Open();
SqlCommand co1=new SqlCommand(Select * From Table1,c);
DataGrid1.DataSource=co1.ExecuteReader();
DataGrid1.DataBind();
c.Close();
}
IN the above code i can get the data in datagrid NAmed DataGrid1, But i
just want to know the Number of Records Found, so that i can verify the
username and password ie. valid or not. ie. if records is non zero the
user is valid if zero its valid.
Can you suggest me how can i get the RecordCount in asp.net.
Satish Katika.
---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to
$subst('Email.Unsub').
Message #4 by Marcus Brim <mbrim@h...> on Mon, 25 Feb 2002 10:22:01 -0600
|
|
Looks like your'e using SQL Server - just run a stored proc to check
for the user and pwd and return the rowcount from that.
-----Original Message-----
From: worleys [mailto:worleys@h...]
Sent: Monday, February 25, 2002 6:42 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Query RecordCount
Arrgghhh, told you I was tired, just to check you state you just want to
check the password and user, if so why are you putting results into a
datagrid, I appologize, if I am missing the obvious, its very early morning
here ;)
Scott
-----Original Message-----
From: Satish Katika [mailto:satishkatika@r...]
Sent: Sunday, February 24, 2002 4:47 AM
To: aspx_beginners
Subject: [aspx_beginners] Query RecordCount
void Page_Load(Object S, EventArgs E)
{
SqlConnection c=new SqlConnection("Provider.....");
c.Open();
SqlCommand co1=new SqlCommand(Select * From Table1,c);
DataGrid1.DataSource=co1.ExecuteReader();
DataGrid1.DataBind();
c.Close();
}
IN the above code i can get the data in datagrid NAmed DataGrid1, But i just
want to know the Number of Records Found, so that i can verify the username
and password ie. valid or not. ie. if records is non zero the user is valid
if zero its valid.
Can you suggest me how can i get the RecordCount in asp.net.
Satish Katika.
---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to $subst('Email.Unsub').
$subst('Email.Unsub').
|
|
 |