Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2008 > C# 2008 aka C# 3.0
|
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 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 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
 
Old December 22nd, 2010, 05:26 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
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)
 
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.
 
Old December 22nd, 2010, 07:48 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
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?
 
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.
 
Old April 6th, 2011, 05:58 AM
Registered User
 
Join Date: Sep 2004
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





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





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