无法使用.net插入oracle (ORA 00911错误)
本文关键字:ORA 00911 错误 oracle 插入 net | 更新日期: 2023-09-27 18:05:47
所以,我正在构建一个c#应用程序,使用。net和oracle 11g express。我已经连接到数据库,但是,由于某种原因,它不能插入到数据库中,它一直给出ORA 00911错误。这是代码:
private void toolStripButton1_Click(object sender, EventArgs e)
{
string salvar;
dbConnection conn = new dbConnection();
try
{
conn.tryconection();
salvar = "INSERT INTO Client(Name, Document, City, Contact, Addr, District, Zipcode, Phone_1, Phone_2, Cel_1, Cel_2, eymael, tobar) VALUES('" + boxNome.Text + "', '" + boxDocumento.Text + "','" + boxCidade.Text + "','" + boxContato.Text + "','" + boxEndereco.Text + "','" + boxBairro.Text + "','" + boxCep.Text + "','" + boxFone1.Text + "','" + boxFone2.Text + "','" + boxCel1.Text + "','" + boxCel2.Text + "','" + boxEmail.Text + "','" + boxComment.Text + "');";
//MessageBox.Show(salvar);
conn.executaInstrucao(salvar);
//conn.executaInstrucao("commit;");
}
catch (Exception g)
{
MessageBox.Show("Problema na conexão");
}
}
这是带有一些随机值的输出字符串,它在SQL Developer上工作并实际添加行:
INSERT INTO Client(Name, Document, City, Contact, Addr, District, Zipcode, Phone_1, Phone_2, Cel_1, Cel_2, eymael, tobar) VALUES('asdassdsad', '15.465.465/4654-54','654654654','654654654','654654654','654654654','65465-465','(65) 4654-6546','(54) 6546-5465','(46) 54654-6546','(65) 46546-5465','4654654654','65465465465');
谁来帮帮我。我不知道出了什么问题。p。:我所有的列都是VARCHAR2
ORA 00911无效字符问题。如果你在你的文本框中有字符,可能会产生问题。就像上面的注释一样,使用SqlCommand.Parameters.AddWithValue,就像Soner Gönül所说的参数