我有下面的oracleCommand,想更改下面的内容,但有错误。。。除了我的+item+和+txtSrcUserID.Text.ToUpper()+。在oracleCommand中。如何将它们添加到我的命令中?
原始
foreach (string Items in listBox39.Items)
{
using (OracleCommand crtCommand = new OracleCommand(@"SELECT REGEXP_REPLACE ( REPLACE ( dbms_metadata.get_ddl ('PROCEDURE', 'HELL_'), '""USER1"".'),'^s+', NULL, 1, 0, 'm') FROM dual", conn1))
{
}
}
我喜欢制作类似于下面的
foreach (string Items in listBox39.Items)
{
using (OracleCommand crtCommand = new OracleCommand(@"SELECT REGEXP_REPLACE ( REPLACE ( dbms_metadata.get_ddl ('PROCEDURE', '+ Items +'), '"" + txtSrcUserID.Text.ToUpper() + "".'),'^s+', NULL, 1, 0, 'm') FROM dual", conn1))
{
}
}
foreach (string Items in listBox39.Items)
{
using (OracleCommand crtCommand = new OracleCommand(@"SELECT REGEXP_REPLACE ( REPLACE ( dbms_metadata.get_ddl ('PROCEDURE', '" + Items + @"'), '""" + txtSrcUserID.Text.ToUpper() + @""".'),'^s+', NULL, 1, 0, 'm') FROM dual", conn1))
{
}
}
但正如@SLaks在评论中建议的那样,最好使用参数:
OracleCommand.Parameters
OracleCommand SQL参数绑定