日期:2014-05-17  浏览次数:20937 次

求高手,这段c#链接access代码哪里错了
这段c#链接access代码哪里错了,点击按钮后跟卡住一样没反应(刚接触C#,请说出修改方法)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data.SqlClient;
using System.IO;

namespace WpfApplication2
{
    /// <summary>
    /// dbWindow1.xaml 的交互逻辑
    /// </summary>
    public partial class dbWindow1 : Window
    {
        public dbWindow1()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string dir = Directory.GetCurrentDirectory();
            using (SqlConnection conn = new SqlConnection("Data Source=" + dir + "db.mdb;DataBase=db"))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = "select * from userinfo";
                    using(SqlDataReader reader = cmd.ExecuteReader())
                    {
                           while(reader.Read())
                           {