473,320 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Trouble updating the Datagrid currency(price) column to database

Have a datagrid that displays the price column in this format $12,400.00 from
a table.

Went to the Property Builder of the datagrid and selected the Price column
and changed the Data formatting expression to {0:c}

*********
Have the following code in the DataGrid1_UpdateCommand event handler
string key = DataGrid1.DataKeys[e.Item.ItemIndex].ToString();

//Price column
TextBox tb = (TextBox) e.Item.Cells[1].Controls[0];
string stPrice = tb.Text.SubString(1); //this is the decimal number without
the '$'
decimal dc = decimal.Parse(stPrice); //convert string number to decimal

DataSet1.CAR_DETAILRow r;

r = dataSet11.CAR_DETAIL.FindByCAR_ID(int.Parse(key));

r.PRICE=dc; //this line causes problems; in my table the datatype of Price is
//number and I keep getting the error "Input string was
not in a
//correct format."

oracleDataAdapter1.Update(dataSet11);
DataGrid1.DataBind();

DataGrid1.EditItemIndex = -1;
DataGrid1.DataBind();

*******************
Can anyone tell me what I'm doing wrong? I've also tried using
Convert.ToDecimal and still same error message.

Any suggestions would be appreciated.

I'm using c# and oracle9i table

Thanks

bebop

Nov 19 '05 #1
0 1082

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

Similar topics

4
by: Steve B. | last post by:
How do I find the column (index) number at runtime of a particular DataGrid column if I know the column header string //somthing like the following int x = datagrid.column;
1
by: Jim Hammond | last post by:
How can one bind a database image column (the byte array - not the path) to a datagrid column? The closest thing I have found so far is this January 2002 statement by Dino Esposito: "Likewise,...
0
by: NWx | last post by:
Hi, I have a Datagrid which display info from a database(SQLServer). Several column in SqlServer table are smalldatetime type, but I use them only for date How can I make Datagrid column to...
9
by: Roy | last post by:
Hey all, On my html page I have a datagrid with the column: <boundColumn datafield="xyz" visible = false> </boundColumn> In my code behind, within item data bound event, I dynamically set the...
1
by: ElenaR | last post by:
I need to figure out how to name my column headers in a DataGrid. In VB6, I could write DataGrid1.Columns(0).Caption = "ID". What is the format for VB.NET? Thanks in Advance!
6
by: Aaron Smith | last post by:
Is there a way to put a limit on the text size of a datagrid column? Thanks, Aaron -- --- Aaron Smith Remove -1- to E-Mail me. Spam Sucks.
2
by: Starbuck | last post by:
Hi Is there anyway of capturing when the users adjusts the width of a datagrid column so the new column width can be stored. Thanks in advance
3
by: Mike L | last post by:
Data in datagrid shows all numbers to the 1000th place. So, $3.00 is shown 3.0000 How do I set the datagrid column to currency format? DataGridColumnStyle colStyle4 = new...
4
by: gane | last post by:
Hi, I am creating datagrid bound column dynamically and need to check if a datagrid column already exists?Is there a way to check this? thanks gane
2
by: mtorres | last post by:
In my VB.Net program I am populatating a datagrid column using Microsoft Access database field that that contains data formated in "Short Time" (03:00). Right now, the datagrid displays the entire...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.