Visual Basic.NET - Ayuda con validacion

 
Vista:
sin imagen de perfil

Ayuda con validacion

Publicado por Luis angel (3 intervenciones) el 15/11/2013 20:13:56
Buenas tardes, tengo el siguiente código espero me puedan ayudar.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        conexion = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\valdezl\Documents\Sistema\BD.mdb")
        conexion.Open()
        da = New OleDb.OleDbDataAdapter("select ISNULL (*) from Facturas", conexion.ConnectionString)
        da.Fill(ds)
        nroreg = 0
        CargarTexto()
    End Sub
 
 Private Sub CargarTexto()
        txtFactura.Text = ds.Tables(0).Rows(nroreg)("ID_Factura")
        txtProveedor.Text = ds.Tables(0).Rows(nroreg)("proveedor")
        txtDescripcion.Text = ds.Tables(0).Rows(nroreg)("descripcion")
        txtFecha.Text = ds.Tables(0).Rows(nroreg)("fecha")
        txtOC.Text = ds.Tables(0).Rows(nroreg)("orden_compra")
        txtTotal.Text = ds.Tables(0).Rows(nroreg)("total")
        archivo = ds.Tables(0).Rows(nroreg)("factura")
        txtEstado.Text = ds.Tables(0).Rows(nroreg)("estado")
    End Sub

en la ultima linea me marca el error: Conversion from type 'DBNull' to type 'String' is not valid.

es porque en la base de datos dengo el campo "Estado" vacio, pero quiero validarlo, como seria??
Espero me puedan ayudar.
Muchas gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder