1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| <%@ Page Language="C#" Debug="true" %>
using System;
using System.Data;
using System.Data.OracleClient;
<script runat="server">
public class Test
{
public static void Main (string[] args)
{
string connectionString =
"Data Source=tabst;" +
"User ID=client;" +
"Password=client;";
OracleConnection dbcon = null;
dbcon = new OracleConnection (connectionString);
dbcon.Open ();
OracleCommand dbcmd = dbcon.CreateCommand ();
string sql = "SELECT name FROM client where subno ='70901661'";
dbcmd.CommandText = sql;
OracleDataReader reader = dbcmd.ExecuteReader ();
while (reader.Read ()) {
string employeeName = (string) reader["name"];
string name = (string) reader["name"];
Console.WriteLine ("Employee Name: {0} name: {1}",
employeeName, name);
}
// clean up
reader.Close ();
reader = null;
dbcmd.CommandText = sql;
dbcmd.ExecuteNonQuery ();
dbcmd.Dispose ();
dbcmd = null;
dbcon.Close ();
dbcon = null;
}
}
// Insert page code here
//
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<!-- Insert content here -->
</form>
</body>
</html> |
Partager