asp.net access 问题!
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string conn = "Provider=Microsoft.Jet.OleDb.4.0;";
conn += @"Data Source=F:\example\book\database\system.mdb";
OleDbConnection oleconn = new OleDbConnection(conn);
oleconn.Open();
OleDbCommand olecommd = new OleDbCommand();
olecommd.Connection = oleconn;
olecommd.CommandText = "select 呢称,QQ from admin";
OleDbDataReader olereader = olecommd.ExecuteReader();
while (olereader.Read())
{
Console.WriteLine("\t{0}\t{1}", olereader["呢称"], olereader["QQ"]);
}
olereader.Close();
oleconn.Close();
}
}
为什么没显示结果也没有报错呢?
谢谢
------解决方案--------------------
用Responst.Write(你要在页面显示的东西);
你的那个是屏输出
这个才是页面输出
再个最好把admin字段加个[]
最后,就是olereader[""]后加个.tostring();