Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 12th, 2009, 08:14 AM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default How to update the sql 2005 DB with decimal values

Hi there i need to update the tabel via the gridview.
Every thing works fine if i update integers like 1,2,3... but when i try 0.12, or 0.3 i get Input string was not in a correct format i tryed to change the data type to :int , then money, smallmoney, decimal, numeric with no succes
can any one please tell me how to do this?

thanks
__________________
bx
 
Old February 12th, 2009, 08:19 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi there.. Maybe your database is expecting a number with another format? maybe a , instead of a . to separe integer from decimal?

Anyway, can you show us the offending line?? also did you try it directly into the database???
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old February 12th, 2009, 08:40 AM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default

Hi thanks for the quick replay
i have not tryed directly to the sql,
here is the table:
Code:
CREATETABLE [dbo].[Campaign](
[CampaignName] [nvarchar](50)NOTNULL,
[Template] [nvarchar](50)NULL,
[PayRate1] [decimal](18, 0)NULL,CONSTRAINT [PK_Campaign] PRIMARYKEYCLUSTERED(



and the stack trace

Code:
[FormatException: Input string was not in a correct format.]
  System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2781995
  System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +112
  System.String.System.IConvertible.ToInt32(IFormatProvider provider) +43
  System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +293
  System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +264
  System.Web.UI.WebControls.SqlDataSourceView.AddParameters(DbCommand command, ParameterCollection reference, IDictionary parameters, IDictionary exclusionList, String oldValuesParameterFormatString) +557
  System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +369
  System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +78
  System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1215
  System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +837
  System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +95
  System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
  System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +117
  System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
  System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115
  System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +132
  System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
how can i try directly to the db?
__________________
bx
 
Old February 12th, 2009, 09:11 AM
bex bex is offline
Friend of Wrox
 
Join Date: Aug 2008
Posts: 154
Thanks: 7
Thanked 1 Time in 1 Post
Default

i did it all i had to do was to use Float DataType
__________________
bx





Similar Threads
Thread Thread Starter Forum Replies Last Post
Sql-Server VB 2005 not able to update DB Patc4 Pro Visual Basic 2005 2 December 15th, 2008 04:57 PM
I can't connect to the sql 2005 developer DB gulfpaddler BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 16 August 21st, 2008 04:17 AM
can't access db in sql server 2005 brillox BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 3 May 3rd, 2007 05:15 PM
DB Migration and SQL Express 2005 gwapojoe BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 3 May 30th, 2006 06:21 AM
Moving db to SQL Server 2005 for deployment LoneStar1 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 4 March 3rd, 2006 01:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.