c#语法错误 (操作符丢失) 在查询表达式 'D:\' 中。
本帖最后由 realdrizzt 于 2014-01-22 09:11:05 编辑 //获取目录路径并导入数据库
private void button9_Click(object sender, EventArgs e)
{
textBox1.Text = fileDir();
OleDbConnection mycon = null;
try
{
string strcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=1.mdb;";
mycon = new OleDbConnection(strcon);
mycon.Open();
string sql = "update dir set dir.filedir = " + textBox1.Text + "";
OleDbDataAdapter ad = new OleDbDataAdapter(sql, strcon);
DataTable dt = new DataTable();
ad.Fill(dt);
}
finally
{
mycon.Close();
}
}
string sql = "update dir set dir.filedir = '" + textBox1.Text + "'";