Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/10/2011, 17:13
mrprogman
 
Fecha de Ingreso: junio-2011
Mensajes: 329
Antigüedad: 12 años, 11 meses
Puntos: 2
Conversion from type 'DBNull' to type 'String' is not valid.

saludos a todos tengo un textbox el cual lleno por medio de un datasource, este es el codigo del datasource
-----------
select sum(venta) from sales2 where sid in (1,2,3,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,2 1) And type In (2,3) and idate>=@idate
-----------

hago la asignacion y valido si el ds no esta vacio con el sig codigo el valor de @idate lo tomo desde un aspdateedit...si le pongo la fecha directo si trabaja

--------------------------------------------------
Dim vtadiariaacum As Data.DataView = SqlDataSource21.Select(DataSourceSelectArguments.E mpty)
If vtadiariaacum.Table.Rows.Count <= 0 Then
TextBox21.Text = "0"
Else
TextBox21.Text = vtadiariaacum.ToTable.Rows(0)("Column1")
Dim resultadovtaacum As Integer = TextBox21.Text
TextBox21.Text = String.Format("${0:#,#0.00}", resultadovtaacum)
-------------------------------------------------------

y me me marca el sig error:

Conversion from type 'DBNull' to type 'String' is not valid.

se me hace muy raro por que inserte un breakpoint y yo veo q la variable si tiene un valor no es ningun valor nulo

alguna idea..?