我有INSERT TO TABLE AG_MAS在FoxPro如下:INSERT在FoxPro
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection connect = new OleDbConnection("Provider=VFPOLEDB.1;Data Source=pl_prov.dbf");
try
{
connect.Open();
string strSQL = "insert into ag_mas";
strSQL += "(ag_code,ag_level,ag_group,ag_rcode,ag_status,";
strSQL += "ag_type,ag_gender,ag_lname,ag_fname,ag_add1,";
strSQL += "ag_add2,ag_add3,ag_add4,ag_class,ag_vouch,";
strSQL += "pl_prov,pl_zone,ag_jdate,ag_ddate,ag_dbrith,ag_bank ,";
strSQL += "ag_bankno,ag_telno,ag_faxno,ag_email,ag_ppay,";
strSQL += "ag_contno,ag_dcont,ag_ladate,ag_lpolno,ag_lendno,";
strSQL += "ag_comm,ag_maxcom,ag_orcomm,ag_om1com,ag_om2com,";
strSQL += "ag_om3com,ag_oy1com, ag_oy2com,ag_oy3com,ag_network)";
strSQL += "values (";
strSQL += "'" + textBox1.Text + "',";//ag_code
strSQL += "'" + textBox2.Text + "',";//ag_level
strSQL += "'" + textBox3.Text + "',";//ag_group
strSQL += "' ' ,"; //ag_rcode
strSQL += "'" + textBox4.Text + "',";//ag_status
strSQL += "'" + textBox22.Text + "',";//ag_type
strSQL += "'" + textBox5.Text + "',";//ag_gender
strSQL += "'" + textBox6.Text + "',";//ag_lname
strSQL += "'" + textBox7.Text + "',";//ag_fname
strSQL += "'" + textBox8.Text + "',";//ag_add1
strSQL += "'" + textBox9.Text + "',";//ag_add2
strSQL += "'" + comboBox1.Text + "',";//ag_add3
strSQL += "' ' ,"; //ag_add4
strSQL += "'" + textBox10.Text + "',";//ag_class
strSQL += "'" + textBox11.Text + "',";//ag_vouch
strSQL += "'" + comboBox1.SelectedValue + "',";//pl_prov
strSQL += "' ' ,"; //pl_zone
strSQL += "'" + textBox12.Text + "',"; //ag_jdate
strSQL += "'1987/10/10',"; //ag_ddate
strSQL += "'1987/10/10',"; //ag_dbirth
strSQL += "' ' ,"; //ag_bank
strSQL += "' ' ,"; //ag_bankno
strSQL += "' ' ,"; //ag_telno
strSQL += "' ' ,"; //ag_faxno
strSQL += "' ' ,"; //ag_email
strSQL += "'" + textBox13.Text + "',"; //ag_ppay
strSQL += "'" + textBox15.Text + "',";//ag_contno
strSQL += "'" + textBox14.Text + "',";//ag_dcont
strSQL += "'1987/10/10', "; //ag_ladate
strSQL += "' ' ,"; //ag_lpopno
strSQL += "' ' ,"; //ag_lendno
strSQL += "0,"; //ag_comm
strSQL += "0,"; //ag_maxcom
strSQL += "0,"; //ag_orcomm
strSQL += "0,"; //ag_om1com
strSQL += "0,"; //ag_om2com
strSQL += "0,"; //ag_om3comm
strSQL += "0,"; //ag_oy1com
strSQL += "0,"; //ag_oy2Xcom
strSQL += "0,"; //ag_oy3com
strSQL += "' ')"; //ag_network
OleDbCommand cmd = new OleDbCommand(strSQL, connect);
cmd.ExecuteNonQuery();
}
catch(Exception err)
{
MessageBox.Show(err.Message);
}
}
}
但我不能插入。因爲錯誤「數據錯失匹配」請幫助我。
非常感謝! – maolddv 2010-09-17 01:19:08