Display Records using classic asp knowledge





If you know how to display the records in classic
asp, with the same knowledge you will be able to understand the csharp
code given here.


 


 


 


 


<%@ Page Language="C#" AutoEventWireup="true"
%>

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

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


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>JTO 2007</title>



</head>

<body>

<%



String sConn="Data Source=xe;User Id=scott;Password=tiger";

OracleConnection myConn = new OracleConnection(sConn);

OracleCommand sql = new OracleCommand("select * from emp",myConn);

OracleDataAdapter da = new OracleDataAdapter(sql);

DataSet ds = new DataSet();

da.Fill(ds,"table1");

%>

<table>

<%foreach (DataRow dr in ds.Tables["table1"].Rows){%>

<tr><td>

<%Response.Write(dr["emp_id"].ToString()); %>

</td>

</tr>

<% }%>

</table>

</body>

</html>