using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.OracleClient;
namespace ScanWebService
{
public class Oracle
{
public OracleConnection conn;
private readonly string connectionString = "data source=JYDB;user=cserp;password=cserp;";
private bool Open()
{
// 打开数据库连接
if (conn == null)
{
conn = new OracleConnection(connectionString);
}
else
{
conn.Close();
conn.Dispose();
conn = new OracleConnection(connectionString);
}
if (conn.State == System.Data.ConnectionState.Closed)
try
{
public int test(string id,string name) {
this.Open();
string sql = "insert into A_TEST(id,name) values(:id,:name)";
OracleCommand cmd = new OracleCommand(sql, conn);
OracleParameter pari = new OracleParameter(":id", id);
cmd.Parameters.Add(pari);
OracleParameter parn = new OracleParameter(":name", name);
cmd.Parameters.Add(parn);
int result = cmd.ExecuteNonQuery();
conn.Close();
cmd.Dispose();
return result;