C# 要在oracle中插入记录
亲爱的各位, 我是这个小组的新成员,也是c#/asp.net的新成员。 我想在oracle中插入记录,我想生成一个主键ID,但查询没有给我新ID。 如果我在oracle中运行此查询,它工作正常。 有什么建议吗C# 要在oracle中插入记录,c#,oracle,C#,Oracle,亲爱的各位, 我是这个小组的新成员,也是c#/asp.net的新成员。 我想在oracle中插入记录,我想生成一个主键ID,但查询没有给我新ID。 如果我在oracle中运行此查询,它工作正常。 有什么建议吗 我想这是为了你 这是样品 记住-使用参数而不是纯查询(SQL注入) 我认为最好使用顺序。检查这个 if (tbsitename.Text != null) { tbsitecode.Text = dm.GetData("select nvl(max
我认为最好使用顺序。检查这个
if (tbsitename.Text != null)
{
tbsitecode.Text = dm.GetData("select nvl(max(to_number(id)),0)+1 from setups_setup").ToString();
//string code = dm.GetData("select lpad(nvl(max(to_number(code)),0)+1,2,0) from setups_setup where type = 'ISITE'").ToString();
MessageBox.Show(dm.GetData("select max(id) from setups_setup").ToString());
//int suc = dm.SetData("Insert into setups_setup(id) values (id)");
//if (suc > 0)
//{
// tbsitecode.Text = dm.GetData("select max(code) from setups_setup where type = 'ISITE'").ToString();
// MessageBox.Show("Record Saved.....");
//}
}