帮助“转换" MS插入到C#方法中的Oracle插入 [英] Help "transform" MS Insert to Oracle Insert in C# method

查看:56
本文介绍了帮助“转换" MS插入到C#方法中的Oracle插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


有谁可以转换下面的C#方法以插入到MS SQL数据库中以插入到Oracle数据库中?

提前谢谢!

Hi,
is there anyone who can transform below C# method for insert into a MS SQL database to insert into an Oracle database?

Thanks in advance!

public void AddItem(string title, string description, decimal price, int categoryID)
{
  SqlConnection con = new SqlConnection(connectionString);

  // Create the Command.
  string insertSQL = "INSERT INTO Items ";
  insertSQL += "(Title, Description, Price, Category_ID)";
  insertSQL += "VALUES (@Title, @Description, @Price, @CategoryID)";

  SqlCommand cmd = new SqlCommand(insertSQL, con);

  cmd.Parameters.AddWithValue("@Title", title);
  cmd.Parameters.AddWithValue("@Description", description);
  cmd.Parameters.AddWithValue("@Price", price);
  cmd.Parameters.AddWithValue("@CategoryID", categoryID);

  try
  {
    con.Open();
    cmd.ExecuteNonQuery();
  }
  finally
  {
    con.Close();
  }
}

推荐答案

我看不到问题-如果运行代码会发生什么错误?
I cant see the problem - what error occurs if you run the code?


这篇关于帮助“转换" MS插入到C#方法中的Oracle插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆