PROBLEMA ASP.NET Y SQL SERVER
Bueno les cuento, tengo que hacer un mantenedor que permita insertar, borrar, mostrar, etc.. y todo se debe hacer por medio de procesos almacenados, todo anda bien en sql los procesos almacenados anda super bien, el problema empieza ahora que deseo insertar datos a la tabla, no los inserta y no entiendo por que, les mando el codigo.
Imports System.Data
Imports System.Data.SqlClient
'Imports System.Data.oledb
Partial Class Default2
Inherits System.Web.UI.Page
Public cn As New SqlConnection(ConfigurationSettings.AppSettings("S qlDataSource1"))
Public ds As New DataSet
Public cmd As SqlCommand
Protected Sub Binsertar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Binsertar.Click
GridView1.DataBind()
cmd = New SqlCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "xpInsertIsapre"
cmd.Connection = cn
Dim da As New SqlDataAdapter
da.InsertCommand = cmd
Dim Isacodigo As New SqlParameter("@vCodigoIsa", SqlDbType.Int)
Dim IsaNombre As New SqlParameter("@vNombreIsa", SqlDbType.VarChar, 50)
da.InsertCommand.Parameters.Add(Isacodigo)
da.InsertCommand.Parameters(0).Value = txtCodigo.Text
da.InsertCommand.Parameters.Add(IsaNombre)
da.InsertCommand.Parameters(1).Value = Txtnombre.Text
Try
Using cn
cn.Open()
da.InsertCommand.ExecuteNonQuery()
da.Dispose()
cmd.Dispose()
End Using
Catch ex As Exception
End Try
GridView1.DataBind()
txtCodigo.Text = ""
Txtnombre.Text = ""
End Sub
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
Dim i As Integer
i = GridView1.SelectedIndex
Me.Txtcodigo.Text = GridView1.SelectedDataKey(0)
Me.Txtnombre.Text = Page.Server.HtmlDecode(GridView1.Rows(i).Cells(1). Text)
Binsertar.Enabled = False
End Sub
End Class
ojalas alguien me pueda ayudar
Imports System.Data
Imports System.Data.SqlClient
'Imports System.Data.oledb
Partial Class Default2
Inherits System.Web.UI.Page
Public cn As New SqlConnection(ConfigurationSettings.AppSettings("S qlDataSource1"))
Public ds As New DataSet
Public cmd As SqlCommand
Protected Sub Binsertar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Binsertar.Click
GridView1.DataBind()
cmd = New SqlCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "xpInsertIsapre"
cmd.Connection = cn
Dim da As New SqlDataAdapter
da.InsertCommand = cmd
Dim Isacodigo As New SqlParameter("@vCodigoIsa", SqlDbType.Int)
Dim IsaNombre As New SqlParameter("@vNombreIsa", SqlDbType.VarChar, 50)
da.InsertCommand.Parameters.Add(Isacodigo)
da.InsertCommand.Parameters(0).Value = txtCodigo.Text
da.InsertCommand.Parameters.Add(IsaNombre)
da.InsertCommand.Parameters(1).Value = Txtnombre.Text
Try
Using cn
cn.Open()
da.InsertCommand.ExecuteNonQuery()
da.Dispose()
cmd.Dispose()
End Using
Catch ex As Exception
End Try
GridView1.DataBind()
txtCodigo.Text = ""
Txtnombre.Text = ""
End Sub
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
Dim i As Integer
i = GridView1.SelectedIndex
Me.Txtcodigo.Text = GridView1.SelectedDataKey(0)
Me.Txtnombre.Text = Page.Server.HtmlDecode(GridView1.Rows(i).Cells(1). Text)
Binsertar.Enabled = False
End Sub
End Class
ojalas alguien me pueda ayudar