473,624 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FormView: Error inserting & updating currency

Hello,

I have a SQL Server 2K table with a field set to currency. When I try to
insert or update a FormView, I get the following error:

Disallowed implicit conversion from data type nvarchar to data type money,
table 'tblCustomer_Re venue', column 'RevenueQtr01'. Use the CONVERT function
to run this query.

Any help with this would be appreciated.
--
Thanks in advance,

sck10
Apr 28 '06 #1
2 2229
The value you are trying to insert into the currency fields is text, probably
coming from a TextBox control or similar. Either way when you assign the
value to your parameter in the database use

Convert.ToDoubl e(MyString);

Which will return a value of type double from your string that represents
the currency amount. Make sure that you strip out any currency symbols
before conversion.

"sck10" wrote:
Hello,

I have a SQL Server 2K table with a field set to currency. When I try to
insert or update a FormView, I get the following error:

Disallowed implicit conversion from data type nvarchar to data type money,
table 'tblCustomer_Re venue', column 'RevenueQtr01'. Use the CONVERT function
to run this query.

Any help with this would be appreciated.
--
Thanks in advance,

sck10

Apr 28 '06 #2
Hi Sck10,

Generally, if the datasource(Data Set, DataTable) bound to the FormView has
defined the column as the correct type(for your case, it's the decimal
type), the runtime should be able to automatically convert the input value
from string to the target type when performing inserting or updating. And
from the error info you provided, the problem seems that the Databound
control hasn't converted the value from string to the decimal type. Would
you provide some further info on the FormView's aspx template and what's
the datasource it bound to, are you using SqlDataSource control?

Regards,

Steven Cheng
Microsoft Online Community Support
=============== =============== =============== =====

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2580
by: yuchang | last post by:
Hi, Using the FormView control is very efficient. But I want to do some action,like showing a success message or redirect to another page, after inserting, updating and deleting. How do I get these message?
4
13533
by: Rob | last post by:
Hey all, So.. a simple FormView/SqlDataSource to handle inserting records into a table. The table has a primary key that the user enters (eg DiscountCode). If the user enters a duplicate the database complains about a primary key violation (which is what I want) and an exception is thrown. The OnInserted event of the SqlDataSource provides access to the exception so, presumably, you can provide nice handling for various errors. For...
1
1673
by: | last post by:
Is there a way to handle when you're on insert mode on a formview and the record you're about to save to the database already exist and insted you rather update instead of inserting and getting an error of primary key? Thanks, Victor
2
2767
by: Kelly | last post by:
I'm fairly new to ASP.NET2, but I have an ASP 3.0 background, and I've been experimenting with the DataSource and FormView widgets. I wound up having some questions along the way which I hope you all can address to help me understand events with these better. I've been reading up on inserted/inserting also deleted/deleting, but where is it better to run call those events from via formview or datasource? Also, I have been trying to...
0
1876
by: hardieca | last post by:
Hi, My formview or gridview control stops updating or deleting a record once the record has a null value. I have table tblTest with the following pkID int NOT NULL **IDENTITY COLUMN** string1 varchar(30) string2 varchar(30)
0
1986
by: =?Utf-8?B?TGFkaXNsYXYgTXJua2E=?= | last post by:
Hello, I read some msdn and other articles about how does databinding among DataSource controls and FormView / GridView controls works but I still don't fully understand to this blackbox. I have few questions and hopefully you can provide me some answers. 1. Best place for DataBinding. Where is the best place for calling DataBind method? Is it possible to say don't bind controls for this postback and use current values instead? These...
3
8094
by: KaOne | last post by:
Hi All, excuse me in advance for my not very perfect english. I need some help about a problem with a FormView bounded to an ObjectDataSource. In practise I have an ObjectDataSource that uses some BLL methods that implements the optimistic concurrency by a TimeStamp field into the DB. So, when I execute an insert, update or delete query if I receive 0 like return value from that queries I understand that a concurrency problem is occurs so...
2
2158
by: Yin99 | last post by:
I have the code below and get the error "cannot change read only object insied a foreach loop" I am hoping someone could graciously provide code example of how I could do this? Thanks! - Yin foreach (DictionaryEntry entry in e.Values) { if (String.Compare(entry.Key.ToString(),"CustomerID")==0) { entry.Value = "5"; }
0
1747
by: =?Utf-8?B?X3ByZWZpeA==?= | last post by:
Hello All, I have written a page with a sqlserverdatasource control and a formview web control. I want to use stored procedures to perform CRUD operations. Formview textboxes bind to table columns to present the data for direct table operations, but textboxes do not bind with the stored procedure parameter name in any simple way. I don’t have an problem with creating and deleting a row because inserting
0
8175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8625
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7168
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2610
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.