Foros > ASP.NET: Ayuda Urgente Funciones Grabar, Eliminar, Actualizar, Insertar

  1. EdgarJ

    Mensajes [2] - Enviado el Domingo 16 de Diciembre de 2007 a las 20:53hs

    Estimados amigos del foro tengo un problema, que no lo puedo resolver y deseo que por favor me ayuden, mi problema es el siguiente:


    La programacion es Visual Estudio 2005


    PROBLEMA: AYUDA POR FAVOR  Desde Ya muchas Gracias
    AL DAR CLICK SOBRE CUALQUIER BOTON ,NO GRABA, NO INSERTA, NO ELIMINA, NO ACTUALIZA,

    POR FAVOR AYUDENME , NO ME DA NINGUN ERROR , SI ALGUIEN ME PUEDE DECIR QUE HAGO, EN QUE ME ESTOY EQUIVOCANDO , O QUE ME FALTA
    mi mail es edgar_jimmyb@hotmail.com....


    DESCRIPCION DEL PROBLEMA
    Tengo una aplicación realizada en ASP.NET,
    - En un formulario web que esta heredado de un masterpage.master.... este formulario se llama secuenciales.aspx.vb
    - En el formulario secuenciales.aspx.vb un SQLDATASTORE, asociado a una base de datos realizada en SQL 2000, cuyo servidor se LLAMA DESARROLLO y la BASE SE LLAMA BASE.
    - Tengo un DATAGRIDVIEW para ver los datos de la tabla CONTB_SECUENCIAL.
    - En secuenciales.aspx.vb tengo varios botones: GRABAR, BUSCAR, ELIMINAR, ACTUALIZAR, con la siguiente programación:

    PROGRAMACION FORMULARIO WEB.. secuenciales.aspx.vb
    Partial Class Secuencial
    Inherits System.Web.UI.Page
    Dim oCon As New Contabilidad.data.dbOpciones
    Private Sub Secuenciales()
    oCon.Server = "DESARROLLO"
    oCon.Database = "BASE"
    oCon.UserId = "sa"
    oCon.Password = "sa"
    End Sub

    Protected Sub cmdInsertar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdInsertar.Click
    Me.Secuenciales()
    Dim _insert As New System.Data.SqlClient.SqlCommand("INSERT INTO CONTB_SECUENCIAL(Int 32 SECUENCIAL_INGRESO, SECUENCIAL_EGRESO, SECUENCIAL_DIARIO, SECUENCIAL_ASIENTO, SECUENCIAL_RETEN_FUENTE, SECUENCIAL_RETEN_IVA) VALUES('" + Me.txtIngreso.Text + "','" + Me.txtEgreso.Text + "','" + Me.txtDiario.Text + "','" + Me.txtAsiento.Text + "','" + Me.txtFuente.Text + "','" + Me.txtIva.Text + ")")
    oCon.Insert_Command = _insert
    Dim status As Boolean = oCon.InsertFields()
    End Sub


    Protected Sub cmdEliminar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdEliminar.Click
    Me.Secuenciales()
    Dim _delete As New System.Data.SqlClient.SqlCommand("DELETE FROM CONTB_SECUENCIAL WHERE SECUENCIAL_ID='" + Me.txtId.Text + "'")
    oCon.Delete_Command = _delete
    Dim status As Boolean = oCon.DeleteFields()
    End Sub

    Protected Sub cmdActualizar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdActualizar.Click
    Me.Secuenciales()
    Dim _update As New System.Data.SqlClient.SqlCommand("UPDATE CONTB_SECUENCIAL " + "SET SECUENCIAL_INGRESO='" + Me.txtIngreso.Text + "',SECUENCIAL_EGRESO='" + Me.txtEgreso.Text + "',SECUENCIAL_DIARIO='" + Me.txtDiario.Text + "',SECUENCIAL_ASIENTO=" + Me.txtAsiento.Text + "',SECUENCIAL_RETEN_FUENTE=" + Me.txtFuente.Text + "',SECUENCIAL_RETEN_IVA=" + Me.txtIva.Text)
    oCon.Update_command = _update
    Dim status As Boolean = oCon.UpdateFields()
    End Sub


    ---- Tengo una CLASE DENOMINADA dbOpciones.vb DONDE ESTA LA SIGUIENTE PROGRAMACION...


    Imports Microsoft.VisualBasic
    Imports System
    Imports System.Collections.Generic
    Imports System.Text
    Imports System.Data
    Imports System.Data.Sql
    Imports System.Data.SqlClient
    Imports System.Data.SqlTypes

    Namespace Contabilidad.data ' Nombre del Namespace como vamos a instancias nuestras paginas aspx
    Public Class dbOpciones 'Creacion de la Clase dbOperaciones
    Sub New()
    End Sub
    'Atributos de nuestra clase
    Private _Database As String
    Private _Delete_command As SqlCommand
    Private _Insert_command As SqlCommand
    Private _Password As String
    Private _Select_Command As SqlCommand
    Private _Server As String
    Private _Update_command As SqlCommand
    Private _UserId As String
    Public [Error] As String
    Public Property Database() As String ' Propiedades de la Clase para acceder desde las paginas aspx
    Get
    Return _Database
    End Get
    Set(ByVal value As String)
    _Database = value
    End Set
    End Property
    Public Property Delete_Command() As SqlCommand
    Get
    Return _Delete_command
    End Get
    Set(ByVal value As SqlCommand)
    _Delete_command = value
    End Set
    End Property
    Public Property Insert_Command() As SqlCommand
    Get
    Return _Insert_command
    End Get
    Set(ByVal value As SqlCommand)
    _Insert_command = value
    End Set
    End Property
    Public Property Password() As String
    Get
    Return _Password
    End Get
    Set(ByVal value As String)
    _Password = value
    End Set
    End Property
    Public Property Select_Command() As SqlCommand
    Get
    Return _Select_Command
    End Get
    Set(ByVal value As SqlCommand)
    _Select_Command = value
    End Set
    End Property
    Public Property Server() As String
    Get
    Return _Server
    End Get
    Set(ByVal value As String)
    _Server = value
    End Set
    End Property
    Public Property Update_command() As SqlCommand
    Get
    Return _Update_command
    End Get
    Set(ByVal value As SqlCommand)
    _Update_command = value
    End Set
    End Property
    Public Property UserId() As String
    Get
    Return _UserId
    End Get
    Set(ByVal value As String)
    _UserId = value
    End Set
    End Property
    'Metodos de nuestra calse
    Public Function GetStringConection() As SqlConnection
    ' Return New SqlConnection("Data Source =..\SQLEXPRESS;AttachDbFilename=C:\MODCONTABILIDAD\App_Data\Base.mdf;Integrated Security=True;User Instance=True")
    Return New SqlConnection("Data source=DESARROLLO;" & _
    "Database= BASE.mdf;" & _
    "User ID=sa;" & _
    "Password=sa;" & _
    "Persist Security Info=True")
    End Function
    'Métodos que interactúan directamente con la base de datos
    'BUSQUEDA Y SELECCION (SELECT)
    Public Function SelectFields() As DataTable
    Dim strCon As String = Me.GetStringConection.ConnectionString
    Dim ds As New DataSet
    Dim oCon As New SqlConnection(strCon)
    Dim da As New SqlDataAdapter(Me.Select_Command.CommandText, oCon)
    Try
    oCon.Open()
    da.Fill(ds)
    Catch ex As Exception
    Me.Error = ex.ToString
    Finally
    oCon.Open()
    End Try
    Return ds.Tables.Item(0)
    End Function
    'INSERTAR (INSERT)
    Public Function InsertFields() As Boolean
    Dim success As Boolean
    Dim oCon As New SqlConnection(Me.GetStringConection.ConnectionString)
    Dim myCommand As New SqlCommand(Me.Insert_Command.CommandText, Me.GetStringConection)
    Try
    myCommand.Connection.Open()
    myCommand.ExecuteNonQuery()
    success = True
    Catch ex As Exception
    Me.Error = ex.ToString
    success = False
    Finally
    oCon.close()
    End Try
    Return success
    End Function
    'ELIMINAR (DELETE)
    Public Function DeleteFields() As Boolean
    Dim success As Boolean
    Dim oCon As New SqlConnection(Me.GetStringConection.ConnectionString)
    Dim myCommand As New SqlCommand(Me.Delete_Command.CommandText, Me.GetStringConection)
    Try
    myCommand.Connection.Open()
    myCommand.ExecuteNonQuery()
    success = True
    Catch ex As Exception
    Me.Error = ex.ToString
    success = False
    Finally
    oCon.Close()
    End Try
    Return success
    End Function
    'ACTUALIZAR (UPDATE)
    Public Function UpdateFields() As Boolean
    Dim success As Boolean
    Dim oCon As New SqlConnection(Me.GetStringConection.ConnectionString)
    Dim myCommand As New SqlCommand(Me.Update_command.CommandText, Me.GetStringConection)
    Try
    myCommand.Connection.Open()
    myCommand.ExecuteNonQuery()
    success = True
    Catch ex As Exception
    Me.Error = ex.ToString
    success = False
    Finally
    oCon.close()
    End Try
    Return success
    End Function
    End Class
    End Namespace

  2. donnie357

    Mensajes [50] - Enviado el Viernes 23 de Mayo de 2008 a las 01:50hs

    publica tu anuncio solo con $1



    http://papanoel.solutionsforyourhealth.com/?ofertalimitada=true

  3. donnie357

    Mensajes [50] - Enviado el Viernes 23 de Mayo de 2008 a las 01:51hs

    publica tu anuncio solo con $1



    http://papanoel.solutionsforyourhealth.com/?ofertalimitada=true


responder

Para poder responder a este tema tenes que ingresar. Si no tenes una cuenta podes registrarse gratis..

publicidad