|
|
 |
BOOK: Professional ASP.NET 2.0 Databases ISBN: 978-0-470-04179-6  | This is the forum to discuss the Wrox book Professional ASP.NET 2.0 Databases by Thiru Thangarathinam; ISBN: 9780470041796 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Professional ASP.NET 2.0 Databases ISBN: 978-0-470-04179-6 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

June 19th, 2007, 03:11 AM
|
|
Registered User
|
|
Join Date: Jun 2007
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
System.FormatException: Input string was not in a
hi,
I have this asp.net script that supposed to get total of
records.But when i run it i get this error.
System.FormatException: Input string was not in a correct format.
Source Error:
Line 310: calctotal(e.Item.Cells(3).Text)
Line 311: e.Item.Cells(3).Text = String.Format("{0:n}", Convert.ToDouble(e.Item.Cells(3).Text))
Line 312:
Line 313: ElseIf (e.Item.ItemType = ListItemType.Footer) Then
i get null value at this line Response.Write(e.Item.Cells(3).Text).can anybody tell me how to fix it?
here is code
Partial Class first
Inherits System.Web.UI.Page
Private rtotal As Double = 0
'protected DataGrid DataGrid1
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim s, s2, fyear As String
s = (Request.QueryString("strtxt"))
Response.Write(s)
fyear = (Request.QueryString("strtxt2"))
Response.Write(fyear)
fyear = "20072008"
'Dim strTxtTransfer As String = Request.QueryString("strTxt")
'Response.Write(strTxtTransfer)
Dim sql_str, sqls As String
If Mid(s, 1, 2) = "TO" Then
sql_str = "Select t.store_invoice_no Inv,c.customer_name customer, to_char(t.invoice_date,'dd/mm/yyyy')inv_dat, t.store_item_pcs pcs, t.store_item_tot_pcs tot_pcs, nvl(t.no_of_packets,1) packets from ho_store_transaction t, customer_master c where store_challan_no= '" & s & "' and t.store_customer_code=c.customer_code and t.store_financial_year_code ='" & fyear & "' and t.store_company_code='DD' and t.store_location_code='L020' UNION Select '','', 'Total',sum(t.store_item_pcs)t_qty1, sum(t.store_item_tot_pcs)t_pcs1, sum(t.no_of_packets)t_packets from ho_store_transaction t, customer_master c where store_challan_no= '" & s & "' and t.store_customer_code=c.customer_code and t.store_financial_year_code ='" & fyear & "' and t.store_company_code='DD' and t.store_location_code='L020'"
Else
'ElseIf Mid(s, 1, 1) = "R" Then
sql_str = "Select m.store_challan_no Inv, c.customer_name customer, to_char(m.store_challan_date,'dd/mm/yyyy')inv_dat, sum(t.store_item_pcs)pcs, sum(t.store_item_tot_pcs)tot_pcs, nvl(t.no_of_packets,1) packets from ho_store_master m, ho_store_transaction t,customer_master c where m.Store_trfout_flag='N' and m.store_challan_no = t.store_challan_no and m.store_customer_code = c.CUSTOMER_CODE and m.store_challan_no = '" & s & "' and to_char(m.store_challan_date,'dd/mm/yyyy')= to_char(t.store_challan_date,'dd/mm/yyyy') and m.store_financial_year_code='" & fyear & "' and m.store_company_code='DD' and m.store_location_code='L020' group by m.store_challan_no,m.store_challan_date,c.customer _name,t.no_of_packets UNION Select '', '', 'Total', sum(t.store_item_pcs)t_qty1, sum(t.store_item_tot_pcs)t_pcs1, nvl(sum(t.no_of_packets),1)t_packets from ho_store_master m, ho_store_transaction t,customer_master c where m.Store_trfout_flag='N' and m.store_challan_no = t.store_challan_no and m.store_customer_code = c.CUSTOMER_CODE and m.store_challan_no = '" & s & "' and to_char(m.store_challan_date,'dd/mm/yyyy')= to_char(t.store_challan_date,'dd/mm/yyyy') and m.store_financial_year_code='" & fyear & "' and m.store_company_code='DD' and m.store_location_code='L020' group by m.store_challan_no,m.store_challan_date,c.customer _name,t.no_of_packets"
End If
Dim str As String
Dim con As OracleConnection
str = "User Id=nfc;Password=nfc;Data Source=dh"
con = New OracleConnection(str)
con.Open()
Dim cmd As New OracleDataAdapter _
(sql_str, con)
Dim ds As Data.DataSet = New Data.DataSet()
cmd.Fill(ds, "ho_store_transaction")
'ds.Merge(ds2)
DataGrid1.DataSource = ds.Tables("ho_store_transaction")
DataGrid1.DataBind()
End Sub
Protected Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then
Response.Write(e.Item.Cells(3).Text)
calctotal(e.Item.Cells(3).Text)
e.Item.Cells(3).Text = String.Format("{0:n}", Convert.ToDouble(e.Item.Cells(3).Text))
ElseIf (e.Item.ItemType = ListItemType.Footer) Then
e.Item.Cells(2).Text = "TOTAL:"
e.Item.Cells(3).Text = String.Format("{0:n}", rtotal)
End If
End Sub
Private Sub calctotal(ByVal _pcs As String)
If IsNumeric(_pcs) Then
Response.Write(_pcs)
rtotal += Double.Parse(_pcs)
End If
End Sub
End Class
please help.
thanks
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |