Expand|Select|Wrap|Line Numbers
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="somepage.aspx.cs" Inherits="xxx" %>
- <%@ Import Namespace="System.Data" %>
- <%@ Import Namespace="System.Data.SqlClient" %>
- <%@ Import Namespace="System.Configuration" %>
- <%@ Import Namespace="System.Xml" %>
- <!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></title>
- </head>
- <%
- SqlConnection con = null;
- SqlCommand cmd = null;
- SqlDataReader rd = null;
- con = new SqlConnection("server=xxx.xxx.xxx.xxx; database=namehere;user=userid;password=password");
- cmd = new SqlCommand("SELECT * FROM tablename", con);
- con.Open();
- rd = cmd.ExecuteReader();
- rd.Read();
- %>
- <table><tr><td>Name:<%Response.Write(rd.GetString(1));%></td></tr></table>
- <%
- rd.Close();
- con.Close();
- %>
Thanks
Dean