日期:2014-05-17 浏览次数:20937 次
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())
{