我用的是vs2005,数据库是access。
为什么导入数据库里的表时,又有一个数据库。就是我把数据库(a.mdb)放在bin下的debug下面,也就是工作目录。当dataGridView导入数据库表的内容时,在SystemA(这是我的项目的名称)这个文件夹下又有(a.mdb),这是怎么个原因?
我删除时debug下的数据库里的表有变化,但是SystemA下的没有变化,而且当再次运行的时候,debug下的数据库表里
的值和SystemA下的一样。我的代码是这样的using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;namespace CardSystem
{
    public partial class ShowCard : Form
    {
        public ShowCard()
        {
            InitializeComponent();
        }        private void ShowCard_Load(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“cardDataSet1.CardInfo”中。您可以根据需要移动或移除它。
            this.cardInfoTableAdapter.Fill(this.cardDataSet1.CardInfo);
        }        private void button1_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value.ToString() == "")
            {
                MessageBox.Show("请选择要删除的行!");
            }
            else
            {
                if (MessageBox.Show("确认删除?", "提示", MessageBoxButtons.YesNo) ==DialogResult.Yes)
                {
                    
                    for (int i = 0; i < this.dataGridView1.SelectedRows.Count; i++)
                    {                        string strRow = this.dataGridView1.SelectedRows[i].Cells[0].Value.ToString();
                        string strRowDel = "delete from CardInfo where ID=" + strRow + "";
                        OleDbCommand cmd = new OleDbCommand(strRowDel, DBHelper.oleCon);
                        DBHelper.oleCon.Open();
                        int count = cmd.ExecuteNonQuery();
                        DBHelper.oleCon.Close();
                    }
                    dataGridView1.Rows.Remove(dataGridView1.SelectedRows[0]);
                }
            }
        }
    }
}