62,052
社区成员
发帖
与我相关
我的任务
分享
using System.Data.SqlClient;
public void Page_Load(object sender,EventArgs e)
{
if(!IsPostBack)
{
using(SqlConnection con = new SqlConnection("Data Source=.;uid=sa;pwd=sa;Database=NorthWind"))
{
string username = (string)Session["username"];
string strSQL = "select * from xinxi where username='"+username +"'";
SqlDataAdapter adapter = new SqlDataAdapter(strSQL,con);
DataSet ds = new DataSet();
adapter.Fill(ds);
foreach(DataRowView drv in ds.Tables[0].DefaultView)
{
Response.Write(drv["字段名一"]+"|"+drv["字段名二"]);
}
}
}
}