Foros del Web

Foros del Web (http://www.forosdelweb.com/)
-   .NET (http://www.forosdelweb.com/f29/)
-   -   procedimientos en asp.net (http://www.forosdelweb.com/f29/procedimientos-asp-net-282989/)

miguelonnnn 26/03/2005 10:14

procedimientos en asp.net
 
mi problemaa es esteee ess q quieroo añadirr a untaa tablaa en sql unoss datoss he estado intentando y no me a salidoo



estee es mi procedimiento funciona ok


SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

create PROCEDURE SGL_INS01_SUGERENCIAS
(@socio varchar(200),
@titulo varchar(300),
@mensaje varchar(3000))
AS
BEGIN TRANSACTION
DECLARE @ULTIMO SMALLINT

SELECT @ULTIMO = CASE WHEN MAX(numero)IS NULL THEN 1
ELSE MAX(numero) + 1
END
FROM sugerencia

INSERT sugerencia(numero,socio,titulo,mensaje,fecha)
VALUES (@ultimo,@socio,@titulo,@mensaje,convert(datetime, getdate(),103))
COMMIT TRANSACTION

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

//------------------------------------------------------------

esto ess lo q he hechoo peroo no añadee no se por q si el procedimiento funcionaa okk qq faltaa paraa q funcionee porr favorrr help meeee

//-----------------------------------------------------------

web.config

<appSettings>

<add key="CadenaConexion" value="Initial catalog=club; Data Source=(local); UID=sa; pwd=;" />

</appSettings>



//-----------------------------------------------------------

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



Dim socio As String = Request.Params("txtitulo")

Dim titulo As String = Request.Params("txtitulo")

Dim sugerencia As String = Request.Params("txsugerencia")

Dim strCadena As String = ConfigurationSettings.AppSettings("CadenaConexion" )

Dim mycommand As New SqlClient.SqlCommand

mycommand.Connection = New SqlConnection(strCadena)

mycommand.CommandType = CommandType.StoredProcedure

mycommand.CommandText = "SGL_INS01_SUGERENCIAS"

Dim Par As New SqlClient.SqlParameter("@socio", SqlDbType.VarChar, 100)

Dim Parametro As New SqlClient.SqlParameter("@titulo", SqlDbType.VarChar, 200)

Dim Categoria As New SqlClient.SqlParameter("@mensaje", SqlDbType.VarChar, 2500)

Par.Value = socio

Parametro.Value = titulo

Categoria.Value = sugerencia

'INSERTO EL PARAMETRO EN EL DA. PARA LUEGO LLENAR EL DS

mycommand.Parameters.Add(Par)

mycommand.Parameters.Add(Parametro)

mycommand.Parameters.Add(Categoria)

mycommand.Connection.Open()

mycommand.ExecuteNonQuery()

mycommand.Connection.Close()

End Sub


La zona horaria es GMT -6. Ahora son las 07:42.

Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.