Wrox Home  
Search P2P Archive for: Go

  Return to Index  

ado_dotnet thread: another asp.net, ado.net & c# question


Message #1 by Duane Douglas <dlists@c...> on Thu, 24 Jan 2002 16:56:55 -0500
hello,



i'm very new to .net, so please bear with me.



i'm getting the following error message:



"CS0117: 'System.Data.SqlClient.SqlDataAdapter' does not contain a 

definition for 'ExecuteReader'"



the code is below (i indicated the line where the error occurs):



<%@ Page Debug="true" %>

<%@ Import Namespace="System" %>

<%@ Import Namespace="System.Data" %>

<%@ Import Namespace="System.Data.SqlClient" %>

<html>

<head>

<title>Weekly Poll Login</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">



</head>

<script language="C#" runat="server">

         private void SubmitBtn_Click(Object sender, EventArgs e) {



                 if (Page.IsValid == true) {



                         SqlConnection myConnection = new 

SqlConnection("Data Source=(local);Initial Catalog=WeeklyPoll;Integrated 

Security=false;User ID=sa;Pwd=");

                         SqlDataAdapter myCommand = new 

SqlDataAdapter("SELECT Count(*)  FROM tblConfiguration WHERE UserName='" + 

txtUserName.Text  + "' AND Password = '" + txtUserPass.Text + "'" , 

myConnection);



                         SqlDataReader myReader;



                         // error occurs on the following line

                         myReader = myCommand.ExecuteReader();

                         int iRecordCount;

                         while (myReader.Read) {

                                 iRecordCount = myReader.GetInt32(0);

                         }



                         if (iRecordCount == 1) {

                                 Response.Redirect("Controls_NavigationTarge 

Response.Redirect("Controls_NavigationTarget.aspx");

                         } else {

                                 lblOutput.Text = "Please Enter a Valid Login";

                         }

                 }

         }

</script>



can someone please help me debug this?



tia



Message #2 by Beulah Rebekah G <gbrebekah@y...> on Thu, 24 Jan 2002 17:21:47 -0800 (PST)
--0-63980360-1011921707=:92606

Content-Type: text/plain; charset=us-ascii





If u are using oledbdataAdapter , u cannot call reader.

u have to use odedbdataReader instead of oledbdataAdapter.

  Duane Douglas <dlists@c...> wrote: hello,



i'm very new to .net, so please bear with me.



i'm getting the following error message:



"CS0117: 'System.Data.SqlClient.SqlDataAdapter' does not contain a 

definition for 'ExecuteReader'"



the code is below (i indicated the line where the error occurs):

























         private void SubmitBtn_Click(Object sender, EventArgs e) {



                 if (Page.IsValid == true) {



                         SqlConnection myConnection = new 

SqlConnection("Data Source=(local);Initial Catalog=WeeklyPoll;Integrated 

Security=false;User ID=sa;Pwd=");

                         SqlDataAdapter myCommand = new 

SqlDataAdapter("SELECT Count(*)  FROM tblConfiguration WHERE UserName='" + 

txtUserName.Text  + "' AND Password = '" + txtUserPass.Text + "'" , 

myConnection);



                         SqlDataReader myReader;



                         // error occurs on the following line

                         myReader = myCommand.ExecuteReader();

                         int iRecordCount;

                         while (myReader.Read) {

                                 iRecordCount = myReader.GetInt32(0);

                         }



                         if (iRecordCount == 1) {

                                 Response.Redirect("Controls_NavigationTarge 

Response.Redirect("Controls_NavigationTarget.aspx");

                         } else {

                                 lblOutput.Text = "Please Enter a Valid Login";

                         }

                 }

         }





can someone please help me debug this?



tia












---------------------------------

Do You Yahoo!?

Yahoo! Auctions Great stuff seeking new owners! Bid now!


Message #3 by Beulah Rebekah G <gbrebekah@y...> on Thu, 24 Jan 2002 17:47:12 -0800 (PST)
--0-1544740394-1011923232=:8020

Content-Type: text/plain; charset=us-ascii





Hi  Duane , 

Try the below code:

 <%@ Page Debug="true" %>

<%@ Import Namespace="System" %>

<%@ Import Namespace="System.Data" %>

<%@ Import Namespace="System.Data.SqlClient" %>

<html>

<head>

<title>Weekly Poll Login</title>

<meta http-equiv="Content-Type" content="text/html; 

charset=iso-8859-1">

</head>

<script language="C#" runat="server">

         private void SubmitBtn_Click(Object sender, EventArgs e) {

                 if (Page.IsValid == true) {

                

   SqlDataReader myReader;

                          SqlConnection myConnection = new SqlConnection("Data Source=(local);Initial Catalog=Idealnet;Integrated
Security=false;User ID=sa;Pwd=");

                         SqlCommand myCommand = new SqlCommand("SELECT Count(*)  FROM Users",myConnection);

          myConnection.Open();

                         // error occurs on the following line

                         myReader = myCommand.ExecuteReader();

                         int iRecordCount;

                         while (myReader.Read()) {

                                 iRecordCount = myReader.GetInt32(0);

                         }

                         if (iRecordCount==1) {

  Response.Redirect("hello.aspx");

  Response.Redirect("Controls_NavigationTarget.aspx");

                         } 

                         else {

                                 lblOutput.Text = "Please Enter a Valid Login";

                        }

                 }

         }

</script>



Regards,

Rebekah

  Duane Douglas <dlists@c...> wrote: hello,



i'm very new to .net, so please bear with me.



i'm getting the following error message:



"CS0117: 'System.Data.SqlClient.SqlDataAdapter' does not contain a 

definition for 'ExecuteReader'"



the code is below (i indicated the line where the error occurs):

























         private void SubmitBtn_Click(Object sender, EventArgs e) {



                 if (Page.IsValid == true) {



                         SqlConnection myConnection = new 

SqlConnection("Data Source=(local);Initial Catalog=WeeklyPoll;Integrated 

Security=false;User ID=sa;Pwd=");

                         SqlDataAdapter myCommand = new 

SqlDataAdapter("SELECT Count(*)  FROM tblConfiguration WHERE UserName='" + 

txtUserName.Text  + "' AND Password = '" + txtUserPass.Text + "'" , 

myConnection);



                         SqlDataReader myReader;



                         // error occurs on the following line

                         myReader = myCommand.ExecuteReader();

                         int iRecordCount;

                         while (myReader.Read) {

                                 iRecordCount = myReader.GetInt32(0);

                         }



                         if (iRecordCount == 1) {

                                 Response.Redirect("Controls_NavigationTarge 

Response.Redirect("Controls_NavigationTarget.aspx");

                         } else {

                                 lblOutput.Text = "Please Enter a Valid Login";

                         }

                 }

         }





can someone please help me debug this?



tia












---------------------------------

Do You Yahoo!?

Yahoo! Auctions Great stuff seeking new owners! Bid now!



  Return to Index