Enlazar dos combobox
Publicado por Jose (7 intervenciones) el 29/09/2016 22:11:02
Hola, estoy tratando de enlazar dos combo:
'---------------------------------------------------------------------------------------------------
el primero me carga bien, el problema esta en el segundo que es dependiente del primero, me sale este error:
An exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll but was not handled in user code
Additional information: No se han especificado valores para algunos de los parámetros requeridos.
If there is a handler for this exception, the program may be safely continued.
'------------------------------------------------------------------------------------------------------
Ayuda!!! me
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Private Sub FrmRemision_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
conexion = New OleDbConnection(ConexionDatos.conectar())
adaptadorCliente = New OleDbDataAdapter("SELECT cliente, id FROM CLIENTE WHERE activo = true", conexion)
construct = New OleDbCommandBuilder(adaptador)
datos = New DataSet()
conexion.Open()
adaptadorCliente.Fill(datos, "CLIENTE")
conexion.Close()
cboCliente.DataSource = datos.Tables("CLIENTE")
cboCliente.DisplayMember = "cliente"
cboCliente.ValueMember = "id"
'cboCliente.SelectedIndex = -1
End Sub
Private Sub cboCliente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboCliente.SelectedIndexChanged
If cboCliente.SelectedIndex >= 0 Then
Dim conexion As New OleDbConnection(ConexionDatos.conectar()) 'cadena conexion
Dim SelectedValue As String = "SELECT contrato, id FROM CONTRATO where idCliente=" + cboCliente.SelectedValue.ToString
Dim comando As New OleDbCommand(SelectedValue, conexion)
Dim adap As New OleDbDataAdapter(comando)
datos = New DataSet()
conexion.Open()
adap.Fill(datos, "CONTRATO")
conexion.Close()
cboContrato.DataSource = datos.Tables("CONTRATO")
cboContrato.DisplayMember = "contrato"
cboContrato.ValueMember = "id"
End If
End Sub
'---------------------------------------------------------------------------------------------------
el primero me carga bien, el problema esta en el segundo que es dependiente del primero, me sale este error:
An exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll but was not handled in user code
Additional information: No se han especificado valores para algunos de los parámetros requeridos.
If there is a handler for this exception, the program may be safely continued.
'------------------------------------------------------------------------------------------------------
Ayuda!!! me
Valora esta pregunta


0