Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - andaluz

#61
.NET (C#, VB.NET, ASP) / Re: fichero .NET
1 Junio 2012, 00:03 AM
ok gracias
#62
.NET (C#, VB.NET, ASP) / fichero .NET
31 Mayo 2012, 22:50 PM
hola a todos, me gustaría saber si el posible mostrar un fichero ".doc, .pdf, ..." es decir, no texto plano en un RichTextBox??

o tendría que abrirlo?? si es esto lo que tendría que hacer, que pasos tendría que seguir?

Saludos
#63
es verdad, no he puesto el código para modificar el registro, el código que he utilizado para actualizar el registro es el siguiente:

Código (vbnet) [Seleccionar]

Private Sub btn_Borrar_Cliente_Modificar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Modificar_Cliente_Modificar.Click
        Dim id_cl As Integer
        Dim Nombre_cl, Apellidos_cl, DNI_cl, Poblacion_cl, Domicilio_cl, Telefono_cl, Correo_cl As String
        Dim i As Integer
        Dim DNI_Buscar As String

        ' almaceno el valor del DNI en un TextBox oculto
        DNI_Buscar = txt_DNI_Cli_Modificar_Oculto.Text

        For i = 0 To ClientesTableAdapter.GetData.Rows.Count - 1
            id_cl = ClientesTableAdapter.GetData.Rows(i).Item(0)
            Nombre_cl = ClientesTableAdapter.GetData.Rows(i).Item(1)
            Apellidos_cl = ClientesTableAdapter.GetData.Rows(i).Item(2)
            DNI_cl = ClientesTableAdapter.GetData.Rows(i).Item(3)
            Poblacion_cl = ClientesTableAdapter.GetData.Rows(i).Item(4)
            Domicilio_cl = ClientesTableAdapter.GetData.Rows(i).Item(5)
            Telefono_cl = ClientesTableAdapter.GetData.Rows(i).Item(6)
            Correo_cl = ClientesTableAdapter.GetData.Rows(i).Item(7)

            ' si el DNI que ha introducido existe
            If DNI_Buscar = DNI_cl Then
                grb_Modificar_Clientes.Enabled = True
                Nombre_cl = txt_Nombre_Cli_Modificar.Text
                Apellidos_cl = txt_Apellidos_Cli_Modificar.Text
                DNI_cl = txt_DNI_Cli_Modificar.Text
                Poblacion_cl = txt_Poblacion_Cli_Modificar.Text
                Domicilio_cl = txt_Domicilio_Cli_Modificar.Text
                Telefono_cl = txt_Telefono_Cli_Modificar.Text
                Correo_cl = txt_Correo_Cli_Modificar.Text

                ' Actualizo el cliente
                ClientesTableAdapter.Update(txt_Nombre_Cli_Modificar.Text, txt_Apellidos_Cli_Modificar.Text,
                                            txt_DNI_Cli_Modificar.Text, txt_Poblacion_Cli_Modificar.Text,
                                            txt_Domicilio_Cli_Modificar.Text, txt_Telefono_Cli_Modificar.Text,
                                            txt_Correo_Cli_Modificar.Text,
                                            id_cl, Nombre_cl, Apellidos_cl, DNI_cl,
                                            Poblacion_cl, Domicilio_cl, Telefono_cl, Correo_cl)
                MessageBox.Show("Cliente modificado", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information)

                Limpiar_TextBox(txt_Nombre_Cli_Modificar.Text, txt_Apellidos_Cli_Modificar.Text,
                                            txt_DNI_Cli_Modificar.Text, txt_Poblacion_Cli_Modificar.Text,
                                            txt_Domicilio_Cli_Modificar.Text, txt_Telefono_Cli_Modificar.Text,
                                            txt_Correo_Cli_Modificar.Text)

                grb_Modificar_Clientes.Enabled = False
                btn_Buscar_Cliente_Modificar.Enabled = True
                btn_Cancelar_Cliente_Modificar.Enabled = False
                btn_Modificar_Cliente_Modificar.Enabled = False
                Exit Sub
            End If
        Next
    End Sub


Saludos
#64
Hola a todos, quiero realizar una actualización a un registro que elijo de una base de datos, pero no me lo actualiza bien, me gustaría saber en que parte del código me he equivocado.

os dejo el código
Código (vbnet) [Seleccionar]

    Private Sub btn_Buscar_Cliente_Modificar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Buscar_Cliente_Modificar.Click
        Dim id_cl As Integer
        Dim Nombre_cl, Apellidos_cl, DNI_cl, Poblacion_cl, Domicilio_cl, Telefono_cl, Correo_cl As String
        Dim i As Integer
        Dim DNI_Buscar As String

        ' pido por pantalla que introduzca el DNI del cliente que queremos buscar
        DNI_Buscar = InputBox("Introduce el DNI del cliente a buscar", "Cliente a buscar")

        ' almaceno el valor del DNI en un TextBox oculto
        txt_DNI_Cli_Modificar_Oculto.Text = DNI_Buscar

        For i = 0 To ClientesTableAdapter.GetData.Rows.Count - 1
            id_cl = ClientesTableAdapter.GetData.Rows(i).Item(0)
            Nombre_cl = ClientesTableAdapter.GetData.Rows(i).Item(1)
            Apellidos_cl = ClientesTableAdapter.GetData.Rows(i).Item(2)
            DNI_cl = ClientesTableAdapter.GetData.Rows(i).Item(3)
            Poblacion_cl = ClientesTableAdapter.GetData.Rows(i).Item(4)
            Domicilio_cl = ClientesTableAdapter.GetData.Rows(i).Item(5)
            Telefono_cl = ClientesTableAdapter.GetData.Rows(i).Item(6)
            Correo_cl = ClientesTableAdapter.GetData.Rows(i).Item(7)

            ' compruebo que ha introducido algun DNI
            If DNI_Buscar = "" Then
                MessageBox.Show("No ha introducido ningun DNI, introduzca alguno", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Exit Sub
            End If

            ' si el DNI que ha introducido existe
            If DNI_Buscar = DNI_cl Then
                grb_Modificar_Clientes.Enabled = True
                txt_Nombre_Cli_Modificar.Text = Nombre_cl
                txt_Apellidos_Cli_Modificar.Text = Apellidos_cl
                txt_DNI_Cli_Modificar.Text = DNI_cl
                txt_Poblacion_Cli_Modificar.Text = Poblacion_cl
                txt_Domicilio_Cli_Modificar.Text = Domicilio_cl
                txt_Telefono_Cli_Modificar.Text = Telefono_cl
                txt_Correo_Cli_Modificar.Text = Correo_cl
                MessageBox.Show("Cliente encontrado", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information)
                MessageBox.Show("Modifique los valores que desee", "Modificar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
                'grb_Modificar_Clientes.Enabled = False
                btn_Buscar_Cliente_Modificar.Enabled = False
                btn_Modificar_Cliente_Modificar.Enabled = True
                btn_Cancelar_Cliente_Modificar.Enabled = True
                Exit Sub
            End If

            ' comprobamos si el DNI introducido existe
            If DNI_Buscar <> DNI_cl Then
            Else
                MessageBox.Show("El DNI que ha introducido no existe", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Exit Sub
            End If
        Next
    End Sub


Saludos
#65
el error que me da al ejecutar la aplicación me la da en esa consulta y dice lo siguiente:
      No se puede agregar o cambiar el registro porque se necesita un registro relacionado en la tabla 'Clientes'
#66
Este es otro error, os comento lo que quiero realizar y a continuación os pongo la consulta que he realizado para ello:
     - quiero que en el combo1 tengo el nombre de los clientes y quiero conseguir es el Id_Venta.
      codigo que yo he realizado:
         
Código
          "SELECT Ventas.Id_Ventas FROM Ventas WHERE Ventas.Id_Cliente IN (SELECT Clientes.Id_Cliente FROM Clientes WHERE Clientes.Nombre='" & cbb_Cod_Venta_Instalacion_ins.Text & "')"

                  El ultimo combo es el nombre del cliente

Las tablas son las siguientes:
Clientes                       Insatlaciones                    Ventas
Id_Cliente                        Id_Instalacion                   Id_Ventas
Nombre                            Descripcion                       Fecha_Venta
Apellidos                           ......                                 ..........
DNI                                  Id_Venta                          Id_Stock
.......                                 Id_Empleado                    Id_Empleado
                                                                               Id_Cliente
#67
que utilidad tiene itendata??

es que no la verdad es que no la conozco y como se utiliza???
#68
Bases de Datos / consulta SQL
25 Mayo 2012, 20:58 PM
Hola a todos, os comento lo que quiero realizar y a continuación os pongo la consulta que he realizado para ello:
     - quiero que en el combo1 tengo el nombre de los clientes y quiero conseguir es el Id_Venta.
      codigo que yo he realizado:
         
Código (sql) [Seleccionar]

          "SELECT Ventas.Id_Ventas FROM Ventas WHERE Ventas.Id_Cliente IN (SELECT Clientes.Id_Cliente FROM Clientes WHERE Clientes.Nombre='" & cbb_Cod_Venta_Instalacion_ins.Text & "')"
         

                  El ultimo combo es el nombre del cliente

Las tablas son las siguientes:
Clientes                       Insatlaciones                    Ventas
Id_Cliente                        Id_Instalacion                   Id_Ventas
Nombre                            Descripcion                       Fecha_Venta
Apellidos                           ......                                 ..........
DNI                                  Id_Venta                          Id_Stock
.......                                 Id_Empleado                    Id_Empleado
                                                                               Id_Cliente
#69
Hola a todos, tengo un error al insertar en la base de datos, el cual me dice "Error no especificado" y la verdad es que no consigo encontrar el fallo, os pongo el código para ver si me pueden ayudar
Código (vbnet) [Seleccionar]

Private Sub btn_Insertar_Ventas_Clientes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Insertar_Ventas_Clientes.Click
       Dim id_marc, id_emp, id_cli As Integer

       ' compruebo que ninguno de los datos de venta a cliente esta vacio
       If cbb_Venta_Client_Insertar.Text = "" Or cbb_Nomb_Emp_Vent_Insertar.Text = "" Or
           cbb_Apel_Emp_Vent_Insertar.Text = "" Or cbb_Marca_Artic_Vent_Insertar.Text = "" Or
           cbb_Articulo_Artic_Vent_Insertar.Text = "" Or cbb_Nomb_Client_Vent_Insertar.Text = "" Or
           cbb_Apel_Client_Vent_Insertar.Text = "" Then
           MessageBox.Show("Alguno/s de los datos del articulo esta vacio, rellenelo", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
           Exit Sub
       End If

       ' consulta para asignar el Id_Marca eligiendo el nombre del proveedor a la tabla modelos
       Dim dtadapterMarca As OleDbDataAdapter = New OleDbDataAdapter("SELECT Id_Marca FROM Marcas WHERE Marcas.Marca='" & cbb_Marca_Artic_Vent_Insertar.Text & "'", conexion_access)
       Dim dtsMarca As New DataSet
       dtadapterMarca.Fill(dtsMarca, "Marcas")
       For Each Fila As DataRow In dtsMarca.Tables("Marcas").Rows
           id_marc = Fila("Id_Marca")
       Next
       
       ' consulta para asignar el Id_empleado eligiendo el empleado
       'Dim id_emp As Integer
       Dim dtadapterEmpleado As OleDbDataAdapter = New OleDbDataAdapter("SELECT Empleados.Id_Empleado FROM Empleados WHERE Empleados.Nombre='" & cbb_Nomb_Emp_Compra.Text & "' AND Empleados.Apellidos='" & cbb_Apel_Emp_Vent_Insertar.Text & "'", conexion_access)
       Dim dtsEmpleado As New DataSet

       dtadapterEmpleado.Fill(dtsEmpleado, "Empleados")
       For Each Fila As DataRow In dtsEmpleado.Tables("Empleados").Rows
           id_emp = Fila("Id_Empleado")
       Next
       
       ' consulta para asignar el Id_cliente eligiendo el nombre del cliente a la tabla ventas
       Dim dtadapterCliente As OleDbDataAdapter = New OleDbDataAdapter("SELECT Id_Cliente FROM Clientes WHERE Clientes.Nombre='" & cbb_Nomb_Client_Vent_Insertar.Text & "' AND Clientes.Apellidos='" & cbb_Apel_Client_Vent_Insertar.Text & "'", conexion_access)
       Dim dtsCliente As New DataSet
       dtadapterCliente.Fill(dtsCliente, "Clientes")
       For Each Fila As DataRow In dtsCliente.Tables("Clientes").Rows
           id_cli = Fila("Id_Cliente")
       Next

       ' inserto los datos en la tabla ventas
       Dim CadenaSql As String = "INSERT INTO Ventas (Fecha_Venta, Pagado, Id_Stock, Id_Empleado, Id_Cliente) VALUES ('" & CDate(cbb_Venta_Client_Insertar.Text) & "'," & chk_Pagado_Venta_Insertar.Checked & "," & "(SELECT TOP 1 Stock.Id_Stock FROM Stock WHERE Stock.Id_Articulo IN (SELECT Articulos.Id_Articulos FROM Articulos WHERE Articulos.Descripcion='" & cbb_Articulo_Artic_Vent_Insertar.Text & "' AND Stock.Vendido=False))," & "(SELECT Empleados.Id_Empleado FROM Empleados WHERE Empleados.Nombre='" & cbb_Nomb_Emp_Vent_Insertar.Text & "' AND Empleados.Apellidos='" & cbb_Apel_Emp_Vent_Insertar.Text & "')," & "(SELECT Clientes.Id_Cliente FROM Clientes WHERE Clientes.Nombre='" & cbb_Nomb_Client_Vent_Insertar.Text & "' AND Clientes.Apellidos='" & cbb_Apel_Client_Vent_Insertar.Text & "'))"
     
       MsgBox(IdStock)
       MsgBox(CadenaSql)
       Dim Comando As New OleDb.OleDbCommand(CadenaSql, conexion_access)
       Comando.Connection.Open()
       Comando.ExecuteNonQuery()
       If Mensaje = "" Then
           MessageBox.Show("La venta se ha insertado correctamente.", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information)
       Else
           MessageBox.Show("La venta se ha insertado correctamente. Debe dispensar al cliente el artículo con número de serie: " & Mensaje, "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information)
       End If

        ' ME GUSTARÍA SABER SI TENGO QUE REDIMENSIONAR LA MATRIZ
       ' redimensionamos el tamaño de la matriz
       'ReDim Preserve S_Ventas(S_Ventas.Length)

       ' para refrescar la tabla me tengo que crear 2 variables
       Dim ta_venta As New ArcoclimaDataSetTableAdapters.VentasTableAdapter
       Dim tabla_venta As New ArcoclimaDataSet.VentasDataTable

       ' refrescamos los valores de la tabla
       tabla_venta = ta_venta.GetData
       ArticulosDataGridView.DataSource = tabla_venta

       Me.Validate()
       Me.VentasBindingSource.EndEdit()
       Me.TableAdapterManager.UpdateAll(Me.ArcoclimaDataSet)

       Comando.Connection.Close()

       ' Limpio el contenido de los TextBox que he insertado en la tabla de empleados
       Limpiar_TextBox(cbb_Marca_Artic_Vent_Insertar.Text, cbb_Articulo_Artic_Vent_Insertar.Text,
                       cbb_Nomb_Emp_Vent_Insertar.Text, cbb_Apel_Emp_Vent_Insertar.Text,
                       cbb_Nomb_Client_Vent_Insertar.Text, cbb_Apel_Client_Vent_Insertar.Text)
       Exit Sub
   End Sub


El Id me lo devuelve correcto, pero no se si el error esta en la consulta o en el código, espero que me puedan ayudar,

Saludos
#70
ok ya sale correcto!!!

Saludos y gracias