积极答复者
C# ERROR [42000] [Microsoft][ODBC Visual FoxPro Driver]Syntax error

问题
-
各位好:
自己编个小工具想提高工作效率,写数据到dbf中,用以下语句建立连接和插入数据时本机运行正常,数据插入成功;但生成安装文件或则将debug下的exe拷到其他人电脑,运行向dbf文件中插入数据时,会报标题的ERROR [42000] [Microsoft][ODBC Visual FoxPro Driver]Syntax error语法错误;
本人代码如下:
string table = this.ghtBox.Text + "GH" + seatno + ".dbf"; string dbfconnStr = @"Driver={Microsoft FoxPro VFP Driver (*.dbf)};SourceType=DBF;SourceDB=" + table + ";Exclusive=NO;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO;"; OdbcConnection dbfconn = new OdbcConnection(); dbfconn.ConnectionString = dbfconnStr; if (File.Exists(table)) { if (MessageBox.Show("过户库:" + table + "已经存在,是否覆盖?", "提示:", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return; File.Delete(table); } FileStream fs = File.Create(table); fs.Write(dbfResource.gh, 0, dbfResource.gh.Length); fs.Close(); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(sqlcomm); sqlcomm.CommandText = "select * from " + st.Interface + ".." + st.Cjhb + " where gsdm = '" + st.SeatNo + "'"; da = new SqlDataAdapter(sqlcomm); da.Fill(ds, "cjhb"); this.toolStripProgressBar1.Maximum = ds.Tables[0].Rows.Count; this.toolStripProgressBar1.Value = 0; dbfconn.Open(); OdbcCommand dbfcmd = new OdbcCommand(); dbfcmd.Connection = dbfconn; try { for (int j = 0; j < ds.Tables[0].Rows.Count; j++) { dbfcmd.CommandText = "insert into " + table + "(Gddm,Gdxm,Bcrq,Cjbh,Gsdm,Cjsl,Bcye,Zqdm,Sbsj,Cjsj,Cjjg,Cjje,Sqbh,Bs,Mjbh) values('" + ds.Tables[0].Rows[j]["gddm"].ToString() + "','" + ds.Tables[0].Rows[j]["gdxm"].ToString() + "','" + ds.Tables[0].Rows[j]["bcrq"].ToString() + "'," + ds.Tables[0].Rows[j]["cjbh"].ToString() + ",'" + ds.Tables[0].Rows[j]["gsdm"].ToString() + "'," + ds.Tables[0].Rows[j]["cjsl"].ToString() + "," + ds.Tables[0].Rows[j]["bcye"].ToString() + ",'" + ds.Tables[0].Rows[j]["zqdm"].ToString() + "','" + ds.Tables[0].Rows[j]["sbsj"].ToString() + "','" + ds.Tables[0].Rows[j]["cjsj"].ToString() + "'," + ds.Tables[0].Rows[j]["cjjg"].ToString() + "," + ds.Tables[0].Rows[j]["cjje"].ToString() + ",'" + ds.Tables[0].Rows[j]["sqbh"].ToString() + "','" + ds.Tables[0].Rows[j]["bs"].ToString() + "','WUXJ')"; dbfcmd.ExecuteNonQuery(); this.toolStripProgressBar1.PerformStep(); cjbh = (int)ds.Tables[0].Rows[j]["cjbh"];//取成交回报表的成交编号 } dbfconn.Close(); sqlcomm.CommandText = "SELECT * FROM " + st.Interface + ".." + st.Ordwth2 + " WHERE status = 'O' AND ordrec = '' AND rec_num NOT IN (SELECT ordrec FROM " + st.Interface + ".." + st.Ordwth2 + " WHERE status IN ('E','F','W'))"; da = new SqlDataAdapter(sqlcomm); da.Fill(ds, "Queren"); this.toolStripProgressBar1.Value = this.toolStripProgressBar1.Maximum; this.toolStripProgressBar1.Maximum = this.toolStripProgressBar1.Maximum + ds.Tables[1].Rows.Count;
连接正常,插入数据时报语法错误,但本人电脑运行正常,别人电脑运行报此问题;
之前查过网站,问多其他人,我也换过驱动还是不行;dbf我是通过资源文件去新建的。vfp版本是6.0
各位大哥看能否给点解决的思路。谢谢