<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.OracleClient"%>
<%@ Page Language="VB" %>
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Dim myValue As Object
myValue = exExecuteScalar()
lblText.Text = myValue.ToString()
End Sub
Function exExecuteScalar() As Object
Dim objConn As System.Data.OracleClient.OracleConnection
Dim objCmd As System.Data.OracleClient.OracleCommand
Dim strConnString,strSQL As String
Dim myScalar As Object
strConnString = "Data Source=TCDB;User Id=myuser;Password=mypassword;"
objConn = New System.Data.OracleClient.OracleConnection(strConnString)
objConn.Open()
strSQL = "SELECT MAX(Used) FROM customer"
objCmd = New System.Data.OracleClient.OracleCommand()
With objCmd
.Connection = objConn
.CommandType = CommandType.Text
.CommandText = strSQL
End With
myScalar = objCmd.ExecuteScalar()
objCmd = Nothing
objConn.Close()
objConn.Close()
objConn = Nothing
Return myScalar
End Function
</script>
<html>
<head>
<title>ThaiCreate.Com ASP.NET - System.Data.OracleClient</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label id="lblText" runat="Server"></asp:Label>
</form>
</body>
</html>