Conexão oracle com olebd c#

353 palavras 2 páginas
using System; using System.Collections.Generic; using System.Data; using System.Data.OleDb; using System.Data.SqlTypes; using System.Linq; using System.Text;

namespace WindowsFormsApplication2
{
class Class1 { public const string delete = "DELETE FROM PRODUTO WHERE cod = ?"; public const string update = "UPDATE PRODUTO SET DESCRICAO = ?, QUANTIDADE = ?, VALORUNITARIO = ? WHERE COD = ?"; public const string select = "SELECT * FROM PRODUTO";

string conn = "Provider=MSDAORA.1; User ID=system; password=unopar; Data Source=localhost; Security Info=true"; OleDbConnection conne;

/*public void con(string P_NOME, object P_SALDO, object P_PRECO, string P_SITUACAO) { //string conn = "Provider=MSDAORA.1; User ID=system; password=unopar; Data Source=localhost; Security Info=true";

conne = new OleDbConnection(conn); conne.Open();

OleDbCommand comando = new OleDbCommand(); comando.Connection = conne; comando.CommandText = string.Format("PROCEDURE SP_INSERT_PRODUTO(P_CODIGO IN INTEGER, P_NOME IN VARCHAR, P_SALDO IN INT, P_PRECO IN DECIMAL, P_SITUACAO IN CHAR"); //comando.CommandText = string.Format("insert into xau values (SEQ.NEXTVAL ,'{0}', {1}, {2},{4})", P_NOME, P_SALDO, P_PRECO, P_SITUACAO); comando.ExecuteNonQuery();

conne.Close(); }*/

public void con(string P_NOME, object P_SALDO, object P_PRECO, string P_SITUACAO) { //string conn = "Provider=MSDAORA.1; User ID=system; password=unopar; Data Source=localhost; Security Info=true";

conne = new OleDbConnection(conn); conne.Open();

OleDbCommand comando = new OleDbCommand(); comando.CommandText = string.Format("begin SP_INSERT_PRODUTO(?,?,?,?); end;"); comando.Connection = conne;

Relacionados