test

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
using System.Data.SqlClient;

namespace BridgeReinforce
{
    public class DAL
    {
        private Ni.DatabassAccess.IDatabaseAccess dao;

        public DAL()
        {
            string strConnection;
            strConnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + AppDomain.CurrentDomain.BaseDirectory;
            strConnection += @"DATA.mdb";
            strConnection += ";Persist Security Info=True";
            dao = Ni.DatabassAccess.DatabaseAccess.GetClass(strConnection);
        }
        public Bridge GetByID(int ID)
        {
            OleDbCommandBuilder cb = new OleDbCommandBuilder();

            Bridge briage = null;
            DataTable dt = dao.GetDataTable("Select Top 1 * from info Where ID = " + ID.ToString());
            if (dt.Rows.Count > 0)
            {
                briage = new Bridge();
                briage.ID = Convert.ToInt32(dt.Rows[0][0]);
}
}
}
posted @ 2010-04-14 22:32  Nickelzhang  阅读(80)  评论(0编辑  收藏  举报