<%@ Page Language="C#" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.Data.OleDb" %>
<%@ import Namespace="System.Data.Odbc" %>
<script runat="server">
void Page_Load(object sender, EventArgs e) {
OdbcConnection myOdbcConnection = new OdbcConnection("driver={SQL Server};server=(local)\\YourDatabase;database=Books;uid=YourID;pwd=letmein;");
myOdbcConnection.Open();
lblOdbcConnectionString.Text = myOdbcConnection.ConnectionString;
lblOdbcConnectionTimeout.Text = Convert.ToString(myOdbcConnection.ConnectionTimeout);
lblOdbcDatabase.Text = myOdbcConnection.Database;
lblOdbcDataSource.Text = myOdbcConnection.DataSource;
lblOdbcDriver.Text = myOdbcConnection.Driver;
lblOdbcServerVersion.Text = myOdbcConnection.ServerVersion;
lblOdbcState.Text = Convert.ToString(myOdbcConnection.State);
myOdbcConnection.Close();
}
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<table>
<tbody>
<tr>
<td>
ConnectionString:
</td>
<td>
<asp:Label id="lblOdbcConnectionString" runat="server">ConnectionString</asp:Label></td>
</tr>
<tr>
<td>
ConnectionTimeout:
</td>
<td>
<asp:Label id="lblOdbcConnectionTimeout" runat="server">ConnectionTimeout</asp:Label></td>
</tr>
<tr>
<td>
Database:
</td>
<td>
<asp:Label id="lblOdbcDatabase" runat="server">Database</asp:Label></td>
</tr>
<tr>
<td>
DataSource:
</td>
<td>
<asp:Label id="lblOdbcDataSource" runat="server">DataSource</asp:Label></td>
</tr>
<tr>
<td>
Driver:
</td>
<td>
<asp:Label id="lblOdbcDriver" runat="server">Driver</asp:Label></td>
</tr>
<tr>
<td>
ServerVersion:
</td>
<td>
<asp:Label id="lblOdbcServerVersion" runat="server">ServerVersion</asp:Label></td>
</tr>
<tr>
<td>
State:
</td>
<td>
<asp:Label id="lblOdbcState" runat="server">State</asp:Label></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
|