C# 与 oracle 的SQL语句问题

图片说明
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog fileName = new OpenFileDialog();
fileName.InitialDirectory = "D:\Users\zwj\Desktop\调试工具";
fileName.Filter = "All files (*.*)|*.*|* files (*.*)|*.*";
fileName.FilterIndex = 2;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
richTextBox1.LoadFile(openFileDialog1.FileName,
RichTextBoxStreamType.PlainText);
}
}

    private void button1_Click(object sender, EventArgs e)
    {
        string str = richTextBox1.Text;
        string[] lines = str.Split(Environment.NewLine.ToCharArray());
        for (int i = 1; i < lines.Length; i++)
        {
            Console.WriteLine(lines[i]);
            string[] linecell = lines[i].Split(new char[] { ',' });
            if (linecell.Length > 2)
            {
               string richTextBo = richTextBox2.Text+ linecell[2] + "\r\n";//读取出身份证号码
                string aaa = AES.AESEncrypt(linecell[2]);
                richTextBox2.Text += aaa + "\r\n"; //对身份证号码进行加密  

                string connString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.6.161) (PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl)));Persist Security Info=True;User Id=zhianguankong2; Password=zhianguankong2123";
                OracleConnection conn = new OracleConnection(connString);
                try
                {

                     conn.Open();  
                   ** string sql = "insert into TB_BLACKLIST(VEHID,CARDID,MANTYPE,TIME,UNITID,ALARMPERSON,ALARMPHONE,ISCANCEL)values(sys_guid(),:s1, null , null , null ,null ,null  , 0)";******
                    OracleCommand cmd = new OracleCommand(sql, conn);
                    OracleParameter[] para = 
                    {  new OracleParameter (":s1", OracleType.NVarChar),};
                    para[0].Value = richTextBox2.Lines;

                    if (aaa == null) 
                    {
                        string qqq = " Update TB_BLACKLIST set VEHID =1";
                        OracleCommand qq = new OracleCommand(qqq, conn);
                    }
                    OracleDataReader odr = cmd.ExecuteReader();

                }
                catch (Exception ee)
                {
                    richTextBox3.Text = (ee.Message); //如果有错误,输出错误信息
                }
                finally
                {
                    conn.Close(); //关闭连接
                }                
            } 
        }

                    ![图片说明](https://img-ask.csdn.net/upload/201507/29/1438130677_239850.png)
上面的是我的任务要求,但是我的SQL语句写错了,报错ORA-01008: 并非所有变量都已绑定,而且我还不知道C#中的richTextBox2.Text每行的数据插入到ORACLE中应该用什么参数,求大家帮忙

1个回答

图片说明 这是任务要求,上面的按钮1 和2 反了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!