Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2008 > C# 2008 aka C# 3.0
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# 2008 aka C# 3.0 Discuss the Visual C# 2008 (aka C# 3.0) language
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2008 aka C# 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 22nd, 2010, 03:55 AM
Registered User
 
Join Date: Dec 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default Help needed in C#.NET windows form

Hi everyone,

I am trying to develop a finance software.And I am stuck in somewhere between.
I have a column named NDeposit (type float) in NormalDeposit table.Now what i want is to query all row from that coulmn.

Next I have a cloumn named ND (type float) in InterestRate table.Now i need to get the value from ND column as well.There is only one row in this table.so only one possible valued of ND.

Then I want to perform the:

All row Values from NDeposit + (All row Values from NDeposit * row value from ND)


NOTE:

I am able to get all rows from NDeposit column.But this value are in object type.I need to convert them to float type all at once.



Please I need a help in C#.NET
Thank you in advacne.I am using visual Studio 2008 and SQL Server 2005
  #2 (permalink)  
Old December 22nd, 2010, 05:26 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Sounds like you need to learn SQL, more than you need to learn C#.

The following would do the calculation for you in the SQL itself, then you just use whatever method you are already using to get NDeposit to get both columns:

Code:
SELECT NormalDeposit.NDeposit, NormalDeposit.NDeposit * InterestRate.ND AS Total FROM NormalDeposit, InterestRate
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
The Following User Says Thank You to samjudson For This Useful Post:
Ashimjungthapa (December 22nd, 2010)
  #3 (permalink)  
Old December 22nd, 2010, 07:34 AM
Registered User
 
Join Date: Dec 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks for the help.I tried that query and it worked.Actually I modified it as:

SELECT NormalDeposit.NDeposit+ NormalDeposit.NDeposit * InterestRate.ND AS Total FROM NormalDeposit, InterestRate

but it only solved my half of the problem.

Actually i need to store this result back into same column i.e

insert into NormalDeposit values NDepsoit.NOw please could you help me in it as well.

Thanks for your help. I really appreciated this.

And looking forward to your suggestion and help.
  #4 (permalink)  
Old December 22nd, 2010, 07:48 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

I think you should post your questions on a SQL forum - you will likely get more answers that way.

It is unclear if you want to insert a new row (in which case INSERT INTO is the correct thing) or you want to update the row (in which case UPDATE is what you want to look at).

Perhaps look up those commands on the Microsoft MSDN site.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
  #5 (permalink)  
Old December 22nd, 2010, 11:19 AM
Registered User
 
Join Date: Dec 2010
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Actually its Update.Thats what i wanna do.
  #6 (permalink)  
Old April 6th, 2011, 05:58 AM
Registered User
 
Join Date: Sep 2004
Location: Madurai, Tamil Nadu, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Ashimjungthapa View Post
Actually its Update.Thats what i wanna do.
Then tryout this code:

Code:
UPDATE NormalDeposit SET             
           NDeposit = NDeposit + (NDeposit * Interest.RateofInterest)
        FROM tbl_NDeposit , (SELECT  CAST(ND AS FLOAT) AS RateofInterest
            FROM InterestRate) AS Interest
 


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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Guidelines needed : multiple windows spacy ASP.NET 1.x and 2.0 Application Design 8 April 21st, 2005 06:02 AM
Files needed to run a VB.Net Windows Apps daniel VB.NET 2002/2003 Basics 2 October 15th, 2004 09:29 AM
email messaging from windows form in vb.net rita General .NET 2 June 20th, 2004 10:41 PM
DateTimePicker in Windows App Form VB.NET LaFeverMF VB.NET 2002/2003 Basics 1 February 13th, 2004 09:50 AM



All times are GMT -4. The time now is 05:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.