基本

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Data;
using System.Configuration;

public partial class _Default : System.Web.UI.Page
{
    string connstr = ConfigurationManager.AppSettings["connstr"];
    string sql = "select * from admin";
  
    protected void Page_Load(object sender, EventArgs e)
    {
        string strConnection = "PRovider=Microsoft.Jet.OleDb.4.0;Data Source=";
        strConnection += Server.MapPath("database.mdb");
        OleDbConnection objConnection = new OleDbConnection(strConnection);
        OleDbCommand objCommand = new OleDbCommand("select * from admin", objConnection);
        objConnection.Open();
        OleDbDataReader objDataReader = objCommand.ExecuteReader();
        if (objDataReader.Read())
        {
            
           TextBox1.Text = Convert.ToString(objDataReader["user"]);
         
       
        }
        
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string ip = Request.UserHostAddress; 
       
    }
}

  

posted @ 2014-04-22 11:04  起初的梦想  阅读(118)  评论(0编辑  收藏  举报