salve a tutti
ho questo codice
e questa stored procedureDim conn As New SqlConnection
conn.ConnectionString = "Data Source=Server\SQLEXPRESS;Initial Catalog=prova1;Integrated Security=True;"
conn.Open()
Dim com As New SqlCommand
com.CommandType = CommandType.StoredProcedure
com.CommandText = "sp_prova"
com.Parameters.Add("@Param1", SqlDbType.Int)
com.Connection = conn
Try
com.ExecuteScalar()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
conn.Close()
non capisco il motivoUSE [prova1]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_prova]-- Add the parameters for the stored procedure here
@Param1 integer
AS
BEGIN
SET NOCOUNT ON;
SELECT * from prova
END
eppure mi dice che la stored procedure richiede un parametro : "@Param1" il quale non è stato dichiarato, eppure lo ho dichiarato!!!!!!
infatti se in output vedo quanti parametri ha il command mi dice 1
cosa sbaglio?
grazie

Rispondi quotando