关于dbf数据读取问题
我读取dbf文件时出现了很奇怪的问题string s = "classroom,id";
textBox1.Text = @"E:\DATA\测试数据\cs_39.dbf";
string strSql = "select * from openrowset" +
@"('MSDASQL','Driver=Microsoft Visual FoxPro Driver;SourceType=DBF;" +
@"SourceDB=" + textBox1.Text + "'," +
"'select" + s + "from " + textBox1.Text + "')";
DataTable dt = new DataTable();
SqlConnection conn = new SqlConnection("server=(local);uid=sa;pwd=sa;database=shcms");
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = conn.CreateCommand();
da.SelectCommand.CommandText = strSql;
da.SelectCommand.Connection.Open();
da.Fill(dt);
dataGridView1.DataSource = dt;
这里如果我直接select classroom,id可以的,但是我select 一个变量s,是里面保存了classroom,id却报错(准备对oledb提供程序MSDASQL执行查询出错)我真的不知道为什么了 高手帮忙一下 --------------------编程问答--------------------
补充:.NET技术 , C#