0

Hi,

This is mahendiran,please anybody help me....

i m getting error like cast from type ‘DBNull’ to type ‘String’ is not valid.

Dim newcollection As String

newcollection = "select sum(AMT_PAID) from PAYMENT_HISTORY where BILL_NO LIKE '*" & Session("BRANCH") & "*' and BILL_MODE='NEW' and "

If Drp_From_Day.SelectedIndex <> 0 And Drp_From_Month.SelectedIndex <> 0 And Drp_From_Year.SelectedIndex <> 0 Then
If Drp_To_Day.SelectedIndex <> 0 And Drp_To_Month.SelectedIndex <> 0 And Drp_To_Year.SelectedIndex <> 0 Then
Dim Fdate, Tdate As Date
Fdate = DateSerial(Val(Drp_From_Year.SelectedItem.Text), Drp_From_Month.SelectedItem.Value, Val(Drp_From_Day.SelectedItem.Text))
Tdate = DateSerial(Val(Drp_To_Year.SelectedItem.Text), Drp_To_Month.SelectedItem.Value, Val(Drp_To_Day.SelectedItem.Text))
newcollection = newcollection & "PAID_DATE>=#" & Fdate & "# AND PAID_DATE<=#" & Tdate & "# "
End If
End If
cmd = New OleDbCommand(newcollection, Conn)
lbl_newcoll.Text = cmd.ExecuteScalar()


help me...................please!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Thanks
Mahendiran

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by emurf
0

Hey Mahendiran, try this in your code; lbl_newcoll.Text = cmd.ExecuteScalar().toString & ""

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.