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

Respuesta
 
Herramientas Desplegado
Antiguo 26-mar-2005, 09:14   #1 (permalink)
miguelonnnn ha deshabilitado el karma
 
Fecha de Ingreso: marzo-2005
Mensajes: 1
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
miguelonnnn 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 20:52.


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