Error: El código de usuario no controlo el OleDbException
Publicado por Juan (2 intervenciones) el 15/11/2017 01:48:56
Buenas Noches querida comunidad de La web del programador, hoy les vengo a pedir ayuda con un codigo para un proyecto de mi escuela, es algo basico crear un menu para facilitar la navegacion en una base de datos, el codigo es el siguiente :
El problema nace en la linea de codigo que esta subrayada arriba y arroja el siguiente mensaje de error
Espero y me puedan ayudar, gracias de antemano
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Diagnostics;
namespace MenuOP
{
public partial class Art : Form
{
public Art()
{
InitializeComponent();
}
private void aRTICULOSBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.aRTICULOSBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.cURSOMADataSet);
}
private void Art_Load(object sender, EventArgs e)
{
// TODO: esta línea de código carga datos en la tabla 'cURSOMADataSet.ARTICULOS' Puede moverla o quitarla según sea necesario.
this.aRTICULOSTableAdapter.Fill(this.cURSOMADataSet.ARTICULOS);
PonerDatosEnElCombo();
}
private void aRTICULOSDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void PonerDatosEnElCombo()
{
string cc = Conexion.conexioncadena;
string comando = "Select * from ARTICULOS";
OleDbDataAdapter DA = new OleDbDataAdapter(comando, cc);
DataTable DT = new DataTable();
DA.Fill(DT);
CBB_Articulos.DataSource = DT;
CBB_Articulos.DisplayMember = "DESCRIPCION";
CBB_Articulos.ValueMember = "CODIGO_ARTICULO";
CBB_Articulos.SelectedIndex = -1;
}
private void CBB_Articulos_SelectedIndexChanged(object sender, EventArgs e)
{
if (CBB_Articulos.SelectedValue != null )
{
string Clave = (CBB_Articulos.SelectedValue.ToString());
string cc = Conexion.conexioncadena;
string comando = string.Format("Select * FROM ARTICULOS WHERE CODIGO_ARTICULO ='{0}'", Clave);
DataTable DT = new DataTable();
OleDbDataAdapter AD = new OleDbDataAdapter(comando, cc);
AD.Fill(DT);
if (DT.Rows.Count > 0)
{
DataRow DR = DT.Rows[0];
txt_Clave.Text = DR["CODIGO_ARTICULO"].ToString();
txt_descripcion.Text = DR["DESCRIPCION"].ToString();
txt_pvp.Text = DR["PVP"].ToString();
}
}
}
}
}
Espero y me puedan ayudar, gracias de antemano
Valora esta pregunta
0