473,324 Members | 2,417 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,324 software developers and data experts.

databinding question

I have a textbox databinded to a dataset (in c#).
The dataset is filled by a dataadapter, which connects to field in an
sql server database.
The field in the database is of type money.
In the application, if I retrieve a row of data, such as 40.00, it
comes back 40.0000.
I need just two digits.
I can't find any option to set the precision.
Im not sure if this would be in the dataset, the database, or where.
Any ideas?
Nov 16 '05 #1
3 1451
Cast it with SQL into string (than take these two digits)and than cast it
again to number, you can do it using CommandText in OleDataCommnd (In
DataAdapter SELECTCommand)or SQLDataCommand,
"dwight0" <dw*******@yahoo.com> wrote in message
news:58**************************@posting.google.c om...
I have a textbox databinded to a dataset (in c#).
The dataset is filled by a dataadapter, which connects to field in an
sql server database.
The field in the database is of type money.
In the application, if I retrieve a row of data, such as 40.00, it
comes back 40.0000.
I need just two digits.
I can't find any option to set the precision.
Im not sure if this would be in the dataset, the database, or where.
Any ideas?

Nov 16 '05 #2
I'm fairly certain you'd need to actually do it on the form. I've personally
never done any data binding to text controls, but my guess is you could
handle it in the TextChanged event. Really, you should probably use some
sort of masked edit control, but the TextChanged event should serve your
needs.

Pete

"dwight0" <dw*******@yahoo.com> wrote in message
news:58**************************@posting.google.c om...
I have a textbox databinded to a dataset (in c#).
The dataset is filled by a dataadapter, which connects to field in an
sql server database.
The field in the database is of type money.
In the application, if I retrieve a row of data, such as 40.00, it
comes back 40.0000.
I need just two digits.
I can't find any option to set the precision.
Im not sure if this would be in the dataset, the database, or where.
Any ideas?

Nov 16 '05 #3
I finally figured it out.
If i set my datatypes from money to decimal in sql server, it lets me
change the "scale" and "precision" unlike the money datatype. i just
leave the precision alone and set the scale to two. i dont see why
anyone would use the money datatype.
<pd******@hotmail.com> wrote in message news:<6e******************************@news.megane tnews.com>...
I'm fairly certain you'd need to actually do it on the form. I've personally
never done any data binding to text controls, but my guess is you could
handle it in the TextChanged event. Really, you should probably use some
sort of masked edit control, but the TextChanged event should serve your
needs.

Pete

"dwight0" <dw*******@yahoo.com> wrote in message
news:58**************************@posting.google.c om...
I have a textbox databinded to a dataset (in c#).
The dataset is filled by a dataadapter, which connects to field in an
sql server database.
The field in the database is of type money.
In the application, if I retrieve a row of data, such as 40.00, it
comes back 40.0000.
I need just two digits.
I can't find any option to set the precision.
Im not sure if this would be in the dataset, the database, or where.
Any ideas?

Nov 16 '05 #4

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

Similar topics

0
by: Victor Jones | last post by:
I have a general question about the approach towards databinding controls with objects. Apart from the databinding offered by .NET to bind data, it can be extended to have the same behavior with...
0
by: Victor Jones | last post by:
I have a general question about the approach towards databinding controls with objects. Apart from the databinding offered by .NET to bind data, it can be extended to have the same behavior with...
4
by: Jason S | last post by:
I haven't been able to find a clear answer to this and I'm hoping someone could enlighten me. As pertains to databinding a control in a repeating fashion(datagrid, repeater, etc.) what event...
4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
2
by: Al Smith | last post by:
I kind of understand how the below works, however I am trying to do it at runtime vrs design time. <asp:TextBox id="TextBox1" runat="server" Text='<%# StateList.SelectedItem.Text...
2
by: Shane | last post by:
When I click on the DataBinding in the properties window a list of options open up called Advanced,Tag and Text. I would like to know what Tag and Text are set to? I hope to Bind a text box to a...
9
by: Dennis | last post by:
I have tried using Databinding for my application but always seem to find it very restrictive (maybe I don't completely understand it enough). I always seem to find it much easier to display a...
5
by: Mark R. Dawson | last post by:
Hi all, I may be missing something with how databinding works but I have bound a datasource to a control and everything is great, the control updates to reflect the state of my datasource when I...
1
by: Zak Lomakus | last post by:
Hi, From my main page (default.aspx) I am calling another .aspx (e.g. otherpage.aspx) page through Javascript using window.showModalDialog. otherpage.aspx has a databoud control (webchart),...
0
by: rb | last post by:
I'm struggling with (probably) basic things using SqlDataSource and DataList. Here's the problem: I need to read the resultset returned by SqlDataSource to perform actions related to visual...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...

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.