p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > ASP.NET and ASP > ASP.NET 2.0 > BOOK: Professional ASP.NET 2.0 Databases ISBN: 978-0-470-04179-6
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 19th, 2007, 03:11 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ShoppingCart.aspx.cs - System.FormatException ??? kalel_4444 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 April 16th, 2008 02:00 AM
Input string was not in a correct format dgood9 ASP.NET 2.0 Professional 2 January 8th, 2007 01:26 PM
Input string was not in a correct format. palleti VB.NET 2002/2003 Basics 2 October 17th, 2006 11:38 AM
Input String was not in a correct format shaileshmark SQL Server 2000 1 July 4th, 2004 11:37 PM
Input string was not in a correct format Jeremy Goldman ASP.NET 1.1 9 December 16th, 2003 06:03 PM



All times are GMT -4. The time now is 12:42 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc