Retroceder   Foros del Web > Programación para sitios web > .NET > web forms

Respuesta
 
Herramientas Desplegado
Antiguo 23-ene-2008, 12:41   #1 (permalink)
laureano59 ha deshabilitado el karma
 
Avatar de laureano59
 
Fecha de Ingreso: febrero-2005
Mensajes: 190
Alegría Problema con Procedimiento almacenado

Hola


Tengo esta función en postgres :

CREATE OR REPLACE FUNCTION add_one(int4)
RETURNS int4 AS
$BODY$BEGIN
RETURN $1 + 1;
END;$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION add_one(int4) OWNER TO postgres;


ya esta lista pero no se como conectarme desde punto net:


Siempre me conecto de esta menra a las tablas:

Dim conexion As Conexion = New Conexion

Dim conex As NpgsqlConnection = New NpgsqlConnection(conexion.Conexion)
Dim adapter = New NpgsqlDataAdapter(sql, conex)
Dim dataset = New DataSet


conex.Open()
adapter.Fill(dataset, tableName)
conex.Close()

Return dataset



Pero en el momento de conectarme a la funcion add_one(int4) no se que hacer.

Gracias por su ayuda.
__________________
Laureano Melo Medina
http://www.callequinta.com
:arriba:
laureano59 está desconectado   Responder Citando
Antiguo 03-feb-2008, 23:56   #2 (permalink)
ultimate ha deshabilitado el karma
 
Fecha de Ingreso: diciembre-2007
Ubicación: Caracas - Venezuela
Mensajes: 55
Re: Problema con Procedimiento almacenado

Asi hago yo para llamar a un stored procedure desde asp.net

////Se realiza la lectura de la cadena de conexion a la base de datos del web.config
//System.Configuration.Configuration rootWebConfig = System.Web.Configuration.WebConfigurationManager.O penWebConfiguration("~/web.config");
////se toma el valor de la cadena de conexion
//ConnectionStringSettings saig = rootWebConfig.ConnectionStrings.ConnectionStrings["saig"];
////se pasa el valor de la cadena de conexion al objeto SqlConnection
//SqlConnection conexion = new SqlConnection(saig.ConnectionString);
//conexion.Open();
//SqlCommand comando = new SqlCommand("nombre_procedimiento_almacenado", conexion);
//comando.CommandType = CommandType.StoredProcedure;
//comando.Parameters.Add("@NH", txtCedula.Text);
//comando.Parameters.Add("@CIP",txtCedula.Text);
//comando.Parameters.Add("@FEC",rdpFechaExamClinico. SelectedDate);
//comando.Parameters.Add("@NDC",ddlNDC.SelectedValue );
//comando.Parameters.Add("@SPC",ddlSPC.SelectedValue );
//comando.Parameters.Add("@NDE",ddlNDE.SelectedValue );
//comando.Parameters.Add("@DPE",ddlDPE.SelectedValue );
//comando.Parameters.Add("@NDR",ddlNDR.SelectedValue );
//comando.Parameters.Add("@NEP",ddlNEP.SelectedValue );
//comando.Parameters.Add("@NDNE",ddlNDNE.SelectedVal ue);
//comando.Parameters.Add("@NRD",ddlNDR.SelectedValue );
//comando.Parameters.Add("@PP",ddlPP.SelectedValue);
//comando.Parameters.Add("@TPA",ddlTPA.SelectedValue );
//comando.Parameters.Add("@EP",ddlEP.SelectedValue);
//comando.Parameters.Add("@NP",ddlNP.SelectedValue);
//comando.Parameters.Add("@TPN",ddlTPN.SelectedValue );
//comando.Parameters.Add("@TP",ddlTP.SelectedValue);
//comando.Parameters.Add("@RX",ddlRX.SelectedValue);
//comando.Parameters.Add("@CIDPRE",txtCedulaDr.Text) ;
//comando.ExecuteNonQuery();
//conexion.Close();
ultimate está desconectado   Responder Citando
Respuesta
No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 03:05.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93