calculating time * rate to get the amount due
calculating time * rate to get the amount due
calculating time * rate to get the amount due
calculating time * rate to get the amount due
calculating time * rate to get the amount due
calculating time * rate to get the amount due calculating time * rate to get the amount due calculating time * rate to get the amount due calculating time * rate to get the amount due calculating time * rate to get the amount due calculating time * rate to get the amount due calculating time * rate to get the amount due calculating time * rate to get the amount due
calculating time * rate to get the amount due calculating time * rate to get the amount due
calculating time * rate to get the amount due
Go Back  Xtreme Visual Basic Talk > > > calculating time * rate to get the amount due


Reply
 
Thread Tools Display Modes
  #1  
Old 04-28-2013, 03:08 PM
brendchc3 brendchc3 is offline
Newcomer
 
Join Date: Apr 2013
Posts: 7
Angry calculating time * rate to get the amount due


Im using VB 2012 with SQL database
Need help calculating time * rate to get the amount due
Code:
Try Dim drParent As DataRow drParent = DB_DaycareDataSet.Tables("Parent").Rows(0) OldNum = drParent("ParentId") Dim C2, B2 As Double Dim TotalHours As Double Dim HourRate = 5.0 Dim Amount As Double C2 = "SingnIn" B2 = "SignOut" Amount = "AmountDue" TotalHours = C2 - B2 + (C2 < B2) Amount = TotalHours * 24 * HourRate Dim UpdateParentStatement As String = "UPDATE Parent " & _ "Set AmountDue = " & Amount & " " & _ "Where ParentId = '" & OldNum & "'" Dim DB_DaycareDataTable As New DataTable Dim ParentAdapter As New SqlDataAdapter(UpdateParentStatement, cn) ParentAdapter.Fill(DB_DaycareDataSet1, "Parent") ParentAdapter.Fill(DB_DaycareDataTable) Amount = "AmountDue" Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical) End Try

Last edited by Gruff; 04-28-2013 at 06:12 PM.
Reply With Quote
  #2  
Old 04-28-2013, 07:50 PM
snarfblam's Avatar
snarfblamcalculating time * rate to get the amount due snarfblam is offline
Senior Contributor

Forum Leader
* Expert *
 
Join Date: Apr 2005
Location: USA
Posts: 896
Default

You haven't asked a question or stated what the problem is...

At any rate, right off the bat, I see this and I'm confused/concerned:
Code:
 Dim C2, B2 As Double
  Dim TotalHours As Double
  Dim HourRate = 5.0
  Dim Amount As Double
  C2 = "SingnIn"
  B2 = "SignOut"
  Amount = "AmountDue"
I recommend you start by including "OPTION STRICT" on the first line of every code file so that it doesn't ignore errors like assigning strings to numeric variables.

What are you trying to do by assigning "AmountDue" to the Amount variable? Is AmountDue a variable? Are you trying to do PHP-style string evaluation? (That won't work in VB if you are.) Elsewhere I see you adding booleans to doubles. Either you're playing code golf and making trick shots, or you're trying to dive in the deep end of VB with little experience and are getting confused about the semantics of everything.

Why don't you break things down a little. Get one part of the function working at a time, step through with the debugger and make sure it works as expected, and if and when you get stuck on a particular point, ask a specific question and it will be easier to help you.
__________________
C# _VB.NET _
Reply With Quote
  #3  
Old 04-28-2013, 09:13 PM
brendchc3 brendchc3 is offline
Newcomer
 
Join Date: Apr 2013
Posts: 7
Default

Wow you nailed that one right on. This is some code for my senior project after having one semester of VB and never connecting with the sql database, so yes I would say Im diving in deep, and very much confused.
This is what Im trying to ....
The program is for a daycare. So the form with this code is to take the signin and signout for the child and calculate the amount due , which should then go to the parent table...Its actually driving me crazy so any assist that you can give would be great..I thank you for getting back and sorry I didnt specify what the heck I was doing.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
calculating time * rate to get the amount due
calculating time * rate to get the amount due
calculating time * rate to get the amount due calculating time * rate to get the amount due
calculating time * rate to get the amount due
calculating time * rate to get the amount due
calculating time * rate to get the amount due calculating time * rate to get the amount due calculating time * rate to get the amount due calculating time * rate to get the amount due calculating time * rate to get the amount due calculating time * rate to get the amount due calculating time * rate to get the amount due
calculating time * rate to get the amount due
calculating time * rate to get the amount due
 
calculating time * rate to get the amount due
calculating time * rate to get the amount due
 
-->