vasquex Posted October 3, 2011 Report Share Posted October 3, 2011 Mi consulta es basicamente esa,¿Como se hace para llamar a un procedimiento almacenado desde visual basic.net? gracias por su ayuda. Link to comment Share on other sites More sharing options...
AshWilliams Posted October 3, 2011 Report Share Posted October 3, 2011 Algo como esto: en SQL SERVER 2000 ingresa y usa la BD Northwind -------------------------------------------------------------- Use Northwind Go Drop Procedure usp_consultaxcat Go Create Procedure usp_consultaxcat @Nomb nVarchar(15) As Select CategoryID,CategoryName From Categories Where CategoryName Like @nomb + '%' Go -------------------------------------------------------------- en VB NET digite lo siguiente 'activando la conneccion ha base de datos Dim ocn As New SqlConnection("Data Source=(local);database=Northwind;integrated security=true;") Dim ocmd As New SqlCommand("usp_consultaxcat",ocn) ocmd.commandtype=CommandType.storeprocedure ocn.open() Dim opara As New SqlParameter("@nomb",SqlDbType.Nvarchar)'si recuerdas el parametro generado en sql @nomb opara.size=15'tamaño de caracteres ha recibir el parametro opara.values=TextBox1.text ocmd.Parameters.Add(opara) Dim oda As New SqlDataAdapter oda.selectcommand=ocmd oda.selectcommand.connection=ocn Dim ods As New Dataset oda.Fill(ods,"usuario") datagrid1.datasource=ods.tables("usuario") Saludos Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now