Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Problem in accessing the data


Message #1 by "Lata Shah" <lalithashank@h...> on Wed, 7 Nov 2001 11:15:18
The WHERE clause does not seem to be working. Could anybody please help me 

in debigging the code down below. I am pasting the code here:



DISPLAY.ASPX



<html>

<title>ADDRESS DIARY</title>

<head>

<h1><center><u>Online Address Diary</u></center></h1>

<body bgcolor="iceblue">

<form method="POST" action="/aspnet/Projects/AddressDiary/address1.aspx" 

runat="server">

	<table>

		<tr>

		<td>Choose&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</td>

		<td>

		<asp:DropDownList id="droplist"  runat="server">

			<asp:ListItem>FirstName</asp:ListItem>

			<asp:ListItem>LastName</asp:ListItem>

			<asp:ListItem>City</asp:ListItem>

			<asp:ListItem>Country</asp:ListItem>

		</asp:DropDownList>

		</td>

		</tr>

	</table>

	<br><br><br><br>

	<table>

		<tr>

		<td>Enter here&nbsp;&nbsp;:</td>

		<td><asp:TextBox id="text" runat="server"/></td>

		</tr>

	</table>

	<p><center><input type="Submit" name="b1" value="Enter"></p>

</form>

</body>

</head>

</html>









ADDRESS1.ASPX



<%@ Import Namespace="System" %>

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

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





<html>



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



	string selfield = "";

	string seltext = "";

	

void Page_Load(Object o, EventArgs e)

{ 

	selfield = Request.Form["droplist"];

	seltext = Request.Form["text"];

	

	Response.Write(selfield);

	Response.Write(seltext);

	ADODataReader dr;

	

	String s= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = 

D:/Lalitha/databases/AddressData.mdb ";

	

	ADOConnection connec = new ADOConnection(s);

	ADOCommand comm = new ADOCommand();

	

	comm.CommandType = CommandType.Text;

	comm.CommandText = "select * from address where FirstName = 

@seltext ";

	comm.ActiveConnection = connec;

	

	connec.Open();

		

	comm.Execute(out dr);

		

	while (dr.Read())

	{

		 Response.Write(dr["FirstName"].ToString() + "  ");

		 Response.Write(dr["LastName"].ToString() + "  ");

		 Response.Write(dr["Email"].ToString() + "  ");

		 Response.Write("<br><br><br>");

	}

	

	

}

</script>

		

</html>





Thanks,

Lata.

Message #2 by "S. Asif Imam" <asifimam@y...> on Wed, 7 Nov 2001 19:03:22 +0500
> comm.CommandText = "select * from address where FirstName 

> @seltext ";

-->  @seltext "; this indicate a  command parameter

correct will be either *******(using System.Data.OleDb;)*****



comm.CommandText = "select * from address where FirstName =  @seltext ";

comm.Parameters.Add (new OleDbParameter("@seltext", OleDbType.VarChar));

comm.Parameters["@seltext"].Value = seltext;



OR

Directly specify the value in string like ..



comm.CommandText = "select * from address where FirstName = ' " + seltext "'

" ;  //dont miss the single quotes..



let me know if it problem   persists.







----- Original Message -----

From: "Lata Shah" <lalithashank@h...>

To: "ASP+" <aspx@p...>

Sent: Wednesday, November 07, 2001 11:15 AM

Subject: [aspx] Problem in accessing the data





> The WHERE clause does not seem to be working. Could anybody please help me

> in debigging the code down below. I am pasting the code here:

>

> DISPLAY.ASPX

>

> <html>

> <title>ADDRESS DIARY</title>

> <head>

> <h1><center><u>Online Address Diary</u></center></h1>

> <body bgcolor="iceblue">

> <form method="POST" action="/aspnet/Projects/AddressDiary/address1.aspx"

> runat="server">

> <table>

> <tr>

> <td>Choose&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</td>

> <td>

> <asp:DropDownList id="droplist"  runat="server">

> <asp:ListItem>FirstName</asp:ListItem>

> <asp:ListItem>LastName</asp:ListItem>

> <asp:ListItem>City</asp:ListItem>

> <asp:ListItem>Country</asp:ListItem>

> </asp:DropDownList>

> </td>

> </tr>

> </table>

> <br><br><br><br>

> <table>

> <tr>

> <td>Enter here&nbsp;&nbsp;:</td>

> <td><asp:TextBox id="text" runat="server"/></td>

> </tr>

> </table>

> <p><center><input type="Submit" name="b1" value="Enter"></p>

> </form>

> </body>

> </head>

> </html>

>

>

>

>

> ADDRESS1.ASPX

>

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

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

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

>

>

> <html>

>

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

>

> string selfield = "";

> string seltext = "";

>

> void Page_Load(Object o, EventArgs e)

> {

> selfield = Request.Form["droplist"];

> seltext = Request.Form["text"];

>

> Response.Write(selfield);

> Response.Write(seltext);

> ADODataReader dr;

>

> String s= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source 

> D:/Lalitha/databases/AddressData.mdb ";

>

> ADOConnection connec = new ADOConnection(s);

> ADOCommand comm = new ADOCommand();

>

> comm.CommandType = CommandType.Text;

> comm.CommandText = "select * from address where FirstName 

> @seltext ";

> comm.ActiveConnection = connec;

>

> connec.Open();

>

> comm.Execute(out dr);

>

> while (dr.Read())

> {

> Response.Write(dr["FirstName"].ToString() + "  ");

> Response.Write(dr["LastName"].ToString() + "  ");

> Response.Write(dr["Email"].ToString() + "  ");

> Response.Write("<br><br><br>");

> }

>

>

> }

> </script>

>

> </html>

>

>

> Thanks,

> Lata.

>

> ---

> VBug Winter Conference 2001

>

> Open Forum:  Dan Appleman will be hosting an open

> forum at The .NET Developer's Conference on

> 29th November 2001.  The session will give

> developers the chance to discuss and question

> Dan on his experience with the .NET environment.

> Dan has been programming Visual Basic since the

> alpha version 1.0.  And with over 10 years

> Visual Basic experience is well qualified to

> help you on your road to being a .NET Guru.

>

> http://www.vbug.co.uk/redirect.asp?url=39&id=17

>

> ---

> You are currently subscribed to

> aspx as: asifimam@y...


> $subst('Email.Unsub')



Message #3 by "Al LeMay" <alemay@d...> on Wed, 7 Nov 2001 08:45:13 -0800
Lata



When dealing with strings you must use the "like" command in SQL

statements.



Example:

Select * from table where column like @string



If you choose to execute the "=3D" you will never get a match because 

the

column may be defined as NVARCHAR(25) but you string is only 15

characters long.  Thus the two are never equal to each other.



I would also advise that you create stored procedures whenever possible.

Then you need only call the stored procedure and the command text you

are using never can be missed typed.



Hope this helps.



Al LeMay

Virtuoso, Ltd.

Quality Assurance Manager

alemay@d...







-----Original Message-----

From: Lata Shah [mailto:lalithashank@h...]

Sent: Wednesday, November 07, 2001 3:15 AM

To: ASP+

Subject: [aspx] Problem in accessing the data





The WHERE clause does not seem to be working. Could anybody please help

me

in debigging the code down below. I am pasting the code here:



DISPLAY.ASPX



<html>

<title>ADDRESS DIARY</title>

<head>

<h1><center><u>Online Address Diary</u></center></h1>

<body bgcolor=3D"iceblue">

<form method=3D"POST" 

action=3D"/aspnet/Projects/AddressDiary/address1.aspx"



runat=3D"server">

	<table>

		<tr>

		<td>Choose&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</td>

		<td>

		<asp:DropDownList id=3D"droplist"  runat=3D"server">

			<asp:ListItem>FirstName</asp:ListItem>

			<asp:ListItem>LastName</asp:ListItem>

			<asp:ListItem>City</asp:ListItem>

			<asp:ListItem>Country</asp:ListItem>

		</asp:DropDownList>

		</td>

		</tr>

	</table>

	<br><br><br><br>

	<table>

		<tr>

		<td>Enter here&nbsp;&nbsp;:</td>

		<td><asp:TextBox id=3D"text" runat=3D"server"/></td>

		</tr>

	</table>

	<p><center><input type=3D"Submit" name=3D"b1" value=3D"Enter"></p>

</form> </body> </head> </html>









ADDRESS1.ASPX



<%@ Import Namespace=3D"System" %>

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

<%@ Import Namespace=3D"System.Data.ADO" %>





<html>



<script language=3D"C#" runat=3D"server" debug=3D"true">



	string selfield =3D "";

	string seltext =3D "";

=09

void Page_Load(Object o, EventArgs e)

{

	selfield =3D Request.Form["droplist"];

	seltext =3D Request.Form["text"];

=09

	Response.Write(selfield);

	Response.Write(seltext);

	ADODataReader dr;

=09

	String s=3D "Provider=3DMicrosoft.Jet.OLEDB.4.0;Data Source =3D

D:/Lalitha/databases/AddressData.mdb ";

=09

	ADOConnection connec =3D new ADOConnection(s);

	ADOCommand comm =3D new ADOCommand();

=09

	comm.CommandType =3D CommandType.Text;

	comm.CommandText =3D "select * from address where FirstName =3D

@seltext ";

	comm.ActiveConnection =3D connec;

=09

	connec.Open();

	=09

	comm.Execute(out dr);

	=09

	while (dr.Read())

	{

		 Response.Write(dr["FirstName"].ToString() + "  ");

		 Response.Write(dr["LastName"].ToString() + "  ");

		 Response.Write(dr["Email"].ToString() + "  ");

		 Response.Write("<br><br><br>");

	}

=09

=09

}

</script>

	=09

</html>





Thanks,

Lata.



---

VBug Winter Conference 2001



Open Forum:  Dan Appleman will be hosting an open

forum at The .NET Developer's Conference on

29th November 2001.  The session will give

developers the chance to discuss and question

Dan on his experience with the .NET environment. 

Dan has been programming Visual Basic since the

alpha version 1.0.  And with over 10 years

Visual Basic experience is well qualified to

help you on your road to being a .NET Guru.



http://www.vbug.co.uk/redirect.asp?url=3D39&id=3D17



---

You are currently subscribed to

aspx as: alemay@d...


$subst('Email.Unsub')

Message #4 by "Lata Shah" <lalithashank@h...> on Wed, 7 Nov 2001 16:59:22
When I include Import namespace System.Data.OleDb....., it gives an error 

saying System.Data does not support. Why? Is it because I am using the 

beta 1 version. If so how do I upgrade to beta 2? Kindly help.







> The WHERE clause does not seem to be working. Could anybody please help 

me 

> in debigging the code down below. I am pasting the code here:

> 

> DISPLAY.ASPX

> 

> <html>

> <title>ADDRESS DIARY</title>

> <head>

> <h1><center><u>Online Address Diary</u></center></h1>

> <body bgcolor="iceblue">

> <form method="POST" action="/aspnet/Projects/AddressDiary/address1.aspx" 

> runat="server">

> 	<table>

> 		<tr>

> 		<td>Choose&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</td>

> 		<td>

> 		<asp:DropDownList id="droplist"  runat="server">

> 			<asp:ListItem>FirstName</asp:ListItem>

> 			<asp:ListItem>LastName</asp:ListItem>

> 			<asp:ListItem>City</asp:ListItem>

> 			<asp:ListItem>Country</asp:ListItem>

> 		</asp:DropDownList>

> 		</td>

> 		</tr>

> 	</table>

> 	<br><br><br><br>

> 	<table>

> 		<tr>

> 		<td>Enter here&nbsp;&nbsp;:</td>

> 		<td><asp:TextBox id="text" runat="server"/></td>

> 		</tr>

> 	</table>

> 	<p><center><input type="Submit" name="b1" value="Enter"></p>

> </form>

> </body>

> </head>

> </html>

> 

> 

> 

> 

> ADDRESS1.ASPX

> 

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

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

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

> 

> 

> <html>

> 

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

> 

> 	string selfield = "";

> 	string seltext = "";

> 	

> void Page_Load(Object o, EventArgs e)

> { 

> 	selfield = Request.Form["droplist"];

> 	seltext = Request.Form["text"];

> 	

> 	Response.Write(selfield);

> 	Response.Write(seltext);

> 	ADODataReader dr;

> 	

> 	String s= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = 

> D:/Lalitha/databases/AddressData.mdb ";

> 	

> 	ADOConnection connec = new ADOConnection(s);

> 	ADOCommand comm = new ADOCommand();

> 	

> 	comm.CommandType = CommandType.Text;

> 	comm.CommandText = "select * from address where FirstName = 

> @seltext ";

> 	comm.ActiveConnection = connec;

> 	

> 	connec.Open();

> 		

> 	comm.Execute(out dr);

> 		

> 	while (dr.Read())

> 	{

> 		 Response.Write(dr["FirstName"].ToString() + "  ");

> 		 Response.Write(dr["LastName"].ToString() + "  ");

> 		 Response.Write(dr["Email"].ToString() + "  ");

> 		 Response.Write("<br><br><br>");

> 	}

> 	

> 	

> }

> </script>

> 		

> </html>

> 

> 

> Thanks,

> Lata.

Message #5 by "Yu, Kevin" <kyu@N...> on Wed, 7 Nov 2001 12:13:22 -0500
go download the beta 2 of asp.net



-----Original Message-----

From: Lata Shah [mailto:lalithashank@h...]

Sent: Wednesday, November 07, 2001 9:59 AM

To: ASP+

Subject: [aspx] Re: Problem in accessing the data





When I include Import namespace System.Data.OleDb....., it gives an error 

saying System.Data does not support. Why? Is it because I am using the 

beta 1 version. If so how do I upgrade to beta 2? Kindly help.







> The WHERE clause does not seem to be working. Could anybody please help 

me 

> in debigging the code down below. I am pasting the code here:

> 

> DISPLAY.ASPX

> 

> <html>

> <title>ADDRESS DIARY</title>

> <head>

> <h1><center><u>Online Address Diary</u></center></h1>

> <body bgcolor="iceblue">

> <form method="POST" action="/aspnet/Projects/AddressDiary/address1.aspx" 

> runat="server">

> 	<table>

> 		<tr>

> 		<td>Choose&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</td>

> 		<td>

> 		<asp:DropDownList id="droplist"  runat="server">

> 			<asp:ListItem>FirstName</asp:ListItem>

> 			<asp:ListItem>LastName</asp:ListItem>

> 			<asp:ListItem>City</asp:ListItem>

> 			<asp:ListItem>Country</asp:ListItem>

> 		</asp:DropDownList>

> 		</td>

> 		</tr>

> 	</table>

> 	<br><br><br><br>

> 	<table>

> 		<tr>

> 		<td>Enter here&nbsp;&nbsp;:</td>

> 		<td><asp:TextBox id="text" runat="server"/></td>

> 		</tr>

> 	</table>

> 	<p><center><input type="Submit" name="b1" value="Enter"></p>

> </form>

> </body>

> </head>

> </html>

> 

> 

> 

> 

> ADDRESS1.ASPX

> 

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

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

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

> 

> 

> <html>

> 

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

> 

> 	string selfield = "";

> 	string seltext = "";

> 	

> void Page_Load(Object o, EventArgs e)

> { 

> 	selfield = Request.Form["droplist"];

> 	seltext = Request.Form["text"];

> 	

> 	Response.Write(selfield);

> 	Response.Write(seltext);

> 	ADODataReader dr;

> 	

> 	String s= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = 

> D:/Lalitha/databases/AddressData.mdb ";

> 	

> 	ADOConnection connec = new ADOConnection(s);

> 	ADOCommand comm = new ADOCommand();

> 	

> 	comm.CommandType = CommandType.Text;

> 	comm.CommandText = "select * from address where FirstName = 

> @seltext ";

> 	comm.ActiveConnection = connec;

> 	

> 	connec.Open();

> 		

> 	comm.Execute(out dr);

> 		

> 	while (dr.Read())

> 	{

> 		 Response.Write(dr["FirstName"].ToString() + "  ");

> 		 Response.Write(dr["LastName"].ToString() + "  ");

> 		 Response.Write(dr["Email"].ToString() + "  ");

> 		 Response.Write("<br><br><br>");

> 	}

> 	

> 	

> }

> </script>

> 		

> </html>

> 

> 

> Thanks,

> Lata.



---

VBug Winter Conference 2001 



Open Forum:  Dan Appleman will be hosting an open 

forum at The .NET Developer's Conference on 

29th November 2001.  The session will give 

developers the chance to discuss and question 

Dan on his experience with the .NET environment.  

Dan has been programming Visual Basic since the 

alpha version 1.0.  And with over 10 years 

Visual Basic experience is well qualified to 

help you on your road to being a .NET Guru.



http://www.vbug.co.uk/redirect.asp?url=39&id=17



---

You are currently subscribed to 

aspx as: kyu@n...


$subst('Email.Unsub')

Message #6 by "Lalitha Shankar" <lalithashank@h...> on Thu, 08 Nov 2001 06:26:30 +0400
<html><div style='background-color:'><DIV>

<P>When I include <FONT color=#ff0000>&lt;%@ Import Namespace="System.Data.OleDb" %&gt;, it gives an error
saying <FONT face=Arial color=#000000>The type or namespace name 'OleDb' does not exist in the class or namespace
'System.Data'</FONT></FONT></P><FONT color=#ff0000><FONT face=Arial
color=#000000></FONT></FONT></DIV>

<P><FONT color=#ff0000>OR</FONT></P>

<P><FONT color=#ff0000>When I give the select statement as : comm.CommandText = "select * from address where FirstName =
' " + seltext " ' ";&nbsp;&nbsp; it gives an error saying&nbsp;(pointing to the select statement)--- <FONT face=Arial
color=#000000>An error occurred during the compilation of a resource required to service this request. Please review the specific
error details below and modify your source code appropriately. </FONT></FONT></P>

<P><FONT color=#ff0000><FONT face=Arial color=#000000>Kindly
help.</FONT><BR><BR></P></FONT>

<P><FONT color=#ff0000></FONT>&nbsp;</P>

<P><FONT color=#ff0000><FONT face=Arial color=#000000></FONT>&nbsp;</P>

<P><BR></P></FONT>

<P>&nbsp;</P>

<P>&nbsp;</P>

<P><BR><BR>&nbsp;</P>

<DIV></DIV>

<DIV></DIV>&gt;From: "S. Asif Imam" <ASIFIMAM@Y...>

<DIV></DIV>&gt;Reply-To: "ASP+" <ASPX@P...>

<DIV></DIV>&gt;To: "ASP+" <ASPX@P...>

<DIV></DIV>&gt;Subject: [aspx] Re: Problem in accessing the data 

<DIV></DIV>&gt;Date: Wed, 7 Nov 2001 19:03:22 +0500 

<DIV></DIV>&gt; 

<DIV></DIV>&gt; &gt; comm.CommandText = "select * from address where FirstName = 

<DIV></DIV>&gt; &gt; @seltext "; 

<DIV></DIV>&gt;--&gt; @seltext "; this indicate a command parameter 

<DIV></DIV>&gt;correct will be either *******(using System.Data.OleDb;)***** 

<DIV></DIV>&gt; 

<DIV></DIV>&gt;comm.CommandText = "select * from address where FirstName = @seltext "; 

<DIV></DIV>&gt;comm.Parameters.Add (new OleDbParameter("@seltext", OleDbType.VarChar)); 

<DIV></DIV>&gt;comm.Parameters["@seltext"].Value = seltext; 

<DIV></DIV>&gt; 

<DIV></DIV>&gt;OR 

<DIV></DIV>&gt;Directly specify the value in string like .. 

<DIV></DIV>&gt; 

<DIV></DIV>&gt;comm.CommandText = "select * from address where FirstName = ' " + seltext "' 

<DIV></DIV>&gt;" ; //dont miss the single quotes.. 

<DIV></DIV>&gt; 

<DIV></DIV>&gt;let me know if it problem persists. 

<DIV></DIV>&gt; 

<DIV></DIV>&gt; 

<DIV></DIV>&gt; 

<DIV></DIV>&gt;----- Original Message ----- 

<DIV></DIV>&gt;From: "Lata Shah" <LALITHASHANK@H...>

<DIV></DIV>&gt;To: "ASP+" <ASPX@P...>

<DIV></DIV>&gt;Sent: Wednesday, November 07, 2001 11:15 AM 

<DIV></DIV>&gt;Subject: [aspx] Problem in accessing the data 

<DIV></DIV>&gt; 

<DIV></DIV>&gt; 

<DIV></DIV>&gt; &gt; The WHERE clause does not seem to be working. Could anybody please help me 

<DIV></DIV>&gt; &gt; in debigging the code down below. I am pasting the code here: 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; DISPLAY.ASPX 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<H1>

<CENTER><U>Online Address Diary</U></CENTER></H1>

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<FORM action=/aspnet/Projects/AddressDiary/address1.aspx method=post DIV <>&gt; &gt; runat="server"&gt; 

<DIV></DIV>&gt; &gt; 

<TABLE>

<DIV></DIV>&gt; &gt; 

<TBODY>

<TR>

<DIV></DIV>&gt; &gt; 

<TD>Choose&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</TD>

<DIV></DIV>&gt; &gt; 

<TD>

<DIV></DIV>&gt; &gt; <?xml:namespace prefix = asp /><asp:DropDownList id=droplist runat="server">

<DIV></DIV>&gt; &gt; <asp:ListItem>FirstName</asp:ListItem> 

<DIV></DIV>&gt; &gt; <asp:ListItem>LastName</asp:ListItem> 

<DIV></DIV>&gt; &gt; <asp:ListItem>City</asp:ListItem> 

<DIV></DIV>&gt; &gt; <asp:ListItem>Country</asp:ListItem> 

<DIV></DIV>&gt; &gt; </asp:DropDownList>

<DIV></DIV>&gt; &gt; </TD>

<DIV></DIV>&gt; &gt; </TR>

<DIV></DIV>&gt; &gt; </TBODY></TABLE>

<DIV></DIV>&gt; &gt; <BR><BR><BR><BR>

<DIV></DIV>&gt; &gt; 

<TABLE>

<DIV></DIV>&gt; &gt; 

<TBODY>

<TR>

<DIV></DIV>&gt; &gt; 

<TD>Enter here&nbsp;&nbsp;:</TD>

<DIV></DIV>&gt; &gt; 

<TD><asp:TextBox id=text runat="server"></asp:TextBox></TD>

<DIV></DIV>&gt; &gt; </TR>

<DIV></DIV>&gt; &gt; </TBODY></TABLE>

<DIV></DIV>&gt; &gt; 

<P>

<CENTER><INPUT type=submit value=Enter name=b1>

<P></P>

<DIV></DIV>&gt; &gt; </FORM>

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; ADDRESS1.ASPX 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; <%@ Import Namespace="System" %>

<DIV></DIV>&gt; &gt; <%@ Import Namespace="System.Data" %>

<DIV></DIV>&gt; &gt; <%@ Import Namespace="System.Data.ADO" %>

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt;

<SCRIPT language=C# runat="server" debug="true">

</DIV>> >

</DIV>> > string selfield = "";

</DIV>> > string seltext = "";

</DIV>> >

</DIV>> > void Page_Load(Object o, EventArgs e)

</DIV>> > {

</DIV>> > selfield = Request.Form["droplist"];

</DIV>> > seltext = Request.Form["text"];

</DIV>> >

</DIV>> > Response.Write(selfield);

</DIV>> > Response.Write(seltext);

</DIV>> > ADODataReader dr;

</DIV>> >

</DIV>> > String s= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source 

</DIV>> > D:/Lalitha/databases/AddressData.mdb ";

</DIV>> >

</DIV>> > ADOConnection connec = new ADOConnection(s);

</DIV>> > ADOCommand comm = new ADOCommand();

</DIV>> >

</DIV>> > comm.CommandType = CommandType.Text;

</DIV>> > comm.CommandText = "select * from address where FirstName 

</DIV>> > @seltext ";

</DIV>> > comm.ActiveConnection = connec;

</DIV>> >

</DIV>> > connec.Open();

</DIV>> >

</DIV>> > comm.Execute(out dr);

</DIV>> >

</DIV>> > while (dr.Read())

</DIV>> > {

</DIV>> > Response.Write(dr["FirstName"].ToString() + "  ");

</DIV>> > Response.Write(dr["LastName"].ToString() + "  ");

</DIV>> > Response.Write(dr["Email"].ToString() + "  ");

</DIV>> > Response.Write("<br><br><br>");

</DIV>> > }

</DIV>> >

</DIV>> >

</DIV>> > }

</DIV>> > </SCRIPT>

 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; Thanks, 

<DIV></DIV>&gt; &gt; Lata. 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; --- 

<DIV></DIV>&gt; &gt; VBug Winter Conference 2001 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; Open Forum: Dan Appleman will be hosting an open 

<DIV></DIV>&gt; &gt; forum at The .NET Developer's Conference on 

<DIV></DIV>&gt; &gt; 29th November 2001. The session will give 

<DIV></DIV>&gt; &gt; developers the chance to discuss and question 

<DIV></DIV>&gt; &gt; Dan on his experience with the .NET environment. 

<DIV></DIV>&gt; &gt; Dan has been programming Visual Basic since the 

<DIV></DIV>&gt; &gt; alpha version 1.0. And with over 10 years 

<DIV></DIV>&gt; &gt; Visual Basic experience is well qualified to 

<DIV></DIV>&gt; &gt; help you on your road to being a .NET Guru. 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; http://www.vbug.co.uk/redirect.asp?url=39&amp;id=17 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; --- 

<DIV></DIV>&gt; &gt; You are currently subscribed to 

<DIV></DIV>&gt; &gt; aspx as: asifimam@y... 

<DIV></DIV>&gt; &gt; 

<DIV></DIV>&gt; &gt; $subst('Email.Unsub') 

<DIV></DIV>&gt; 

<DIV></DIV>&gt; 

<DIV></DIV>&gt;--- 

<DIV></DIV>&gt;VBug Winter Conference 2001 

<DIV></DIV>&gt; 

<DIV></DIV>&gt;Open Forum: Dan Appleman will be hosting an open 

<DIV></DIV>&gt;forum at The .NET Developer's Conference on 

<DIV></DIV>&gt;29th November 2001. The session will give 

<DIV></DIV>&gt;developers the chance to discuss and question 

<DIV></DIV>&gt;Dan on his experience with the .NET environment. 

<DIV></DIV>&gt;Dan has been programming Visual Basic since the 

<DIV></DIV>&gt;alpha version 1.0. And with over 10 years 

<DIV></DIV>&gt;Visual Basic experience is well qualified to 

<DIV></DIV>&gt;help you on your road to being a .NET Guru. 

<DIV></DIV>&gt; 

<DIV></DIV>&gt;http://www.vbug.co.uk/redirect.asp?url=39&amp;id=17 

<DIV></DIV>&gt; 

<DIV></DIV>&gt;--- 

<DIV></DIV>&gt;You are currently subscribed to 

<DIV></DIV>&gt;aspx as: lalithashank@h... 

<DIV></DIV>&gt;

<DIV></DIV>&gt;$subst('Email.Unsub') 

<DIV></DIV></CENTER></div><br clear=all><hr>Get your FREE download of MSN Explorer at <a
href='http://go.msn.com/bql/hmtag_itl_EN.asp'>http://explorer.msn.com</a><br></html>

Message #7 by "S. Asif Imam" <asifimam@y...> on Thu, 8 Nov 2001 11:58:02 +0500
Please use these two files ..

Tested on Beta 2.. Beta one is not recommended to use as, good difference is

there, and you have to learn again to acomodate your self in Beta2.



/***************************************************************************

*/

Display.aspx

/***************************************************************************

*/

<%@ Page %>

<html>

 <head>

  <title>ADDRESS DIARY</title>

 </head>

 <body bgcolor="#0cb0e0">

  <P align="center">

   <u><STRONG><FONT size="6">Online Address Diary</FONT></STRONG></u>

  </P>

  <form name="myform" action="Address1.aspx" method="post">

   <table>

    <tr>

     <td>

      Choose&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:

     </td>

     <td>

      <asp:DropDownList id="droplist" runat="server">

       <asp:ListItem>FirstName</asp:ListItem>

       <asp:ListItem>LastName</asp:ListItem>

       <asp:ListItem>City</asp:ListItem>

       <asp:ListItem>Country</asp:ListItem>

      </asp:DropDownList>

     </td>

    </tr>

   </table>

   <br>

   <table>

    <tr>

     <td>

      Enter here&nbsp;&nbsp;:

     </td>

     <td>

      <asp:TextBox id="text" runat="server" />

     </td>

    </tr>

   </table>

   <br>

   <input type="submit" value="  Enter  " runat="server">

  </form>

 </body>

</html>

/***************************************************************************

*/

/***************************************************************************

*/

Address1.aspx

/***************************************************************************

*/

<%@ Page %>

<%@ Import Namespace="System" %>

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

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

<HTML>

 <TITLE>Search Results</TITLE>

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



void Page_Load(Object o, EventArgs e)

{

 string selfield = "";

 string seltext = "";



 selfield = Request.Form["droplist"];

 seltext = Request.Form["text"];



 Response.Write("<b>Search against...</b><br>");

 Response.Write("Field : " + selfield +"<br>");

 Response.Write("Value : " + seltext + "<br>");



 Response.Write("<b>Search Results...</b><br>" );

 OleDbDataReader dr;



 String s= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source 

D:/Lalitah/Databases/Addressdata.mdb ";



 OleDbConnection connec = new OleDbConnection(s);

 OleDbCommand comm = new OleDbCommand();



 comm.CommandType = CommandType.Text;

 comm.CommandText = "select * from address where " + selfield +" = '"+

seltext +"'";

 comm.Connection = connec;



 connec.Open();



 dr = comm.ExecuteReader();



 while (dr.Read()){



  Response.Write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>First Name:</b> " +

dr["FirstName"].ToString() + "  ");

  Response.Write("<br>");

  Response.Write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Last Name: </b>" +

dr["LastName"].ToString() + "  ");

  Response.Write("<br>");

  Response.Write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Email: </b>" +

dr["Email"].ToString() + "  ");

  Response.Write("<br>");



Response.Write("<b>****************************************************</b>"

);

  Response.Write("<br><br>");

 }

 dr.Close();



}

 </script>

 <body bgColor="#99ccff" text="navy">

 </body>

</HTML>

/***************************************************************************

*/




  Return to Index