下面是SQL数据库连接DropDownList代码:
using (SqlDataReader read = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, "select * from link_table", null))
        {
            this.dropLink.DataSource = read;
            this.dropLink.DataTextField = "linkname";
            this.dropLink.DataValueField = "linkurl";
            this.dropLink.DataBind();
        }
怎么改成ACCESS连接?我已经做到下面这一步了
OleDbConnection conn = new OleDbConnection(ConfigurationManager.AppSettings["ConnectionString"]);
后面就不知怎么写了,请教高手,谢谢!!

解决方案 »

  1.   

    都采用OleDb空间下的类,如SqlDataReader 改成OleDbDataReader 
    OleDbCommand等
      

  2.   


    +1,另外还要注意sql和ac的不同,比如sql没有bool,一般用bit字段代替,0为false,1为true
      

  3.   

    方法都是一样的,就是把Sql...改成OleDb... 就好了
      

  4.   

    配置文件中加入: <connectionStrings> <add name="ConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\数据库名.mdb" providerName="System.Data.OleDb"/>
    </connectionStrings>
      

  5.   

    1. 把Sqlxxxxx这样的类,换作OleDBxxxxx
    2. 适当修改连接串,具体请根据Access版本在这里寻找:http://connectionstrings.com/
      

  6.   

    谢谢!!可是我没有SqlHelper类啊,上面代码我是在网上看到的,我是用OleDbConnection conn = new OleDbConnection(ConfigurationManager.AppSettings["ConnectionString"]);
    连接数据库的,接下来应该怎么修改?
      

  7.   

    ACC和SQL 是一样的 你可以去下个AccessHelper去访问数据库
      

  8.   

    改成OLEDB...就行了  方法一样!