| Author |
Topic |
|
hdew2
Starting Member
8 Posts |
Posted - 2012-01-06 : 22:46:55
|
| hi,,i'm new in here,,and just know about sql server 2008,, i want to make a program with vb6, dan databasenya di sql server 2008...i want to ask, how or what syntax to get amount like example this: ex: 19900/10000 = 1 ?thanks for your help |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-07 : 00:42:19
|
| sorry your question is not clearare you passing values in harcoded form or is it coming from table field?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
hdew2
Starting Member
8 Posts |
Posted - 2012-01-08 : 08:05:56
|
i want to modify amount with point ,where 1 point = 10000..ex: amount = 19900 => 19900/10000 = 1 point..just like that..i dont know what the syntax to use it...calling procedure in sql server 2008 in store procedured...the program is made by anyone else..not me...i'm just to modify...n i cannot understand it... sorry about my english...i can speak a little...thank's |
 |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2012-01-08 : 08:41:39
|
| I don't think we can help you understand a procedure unless you post it's definition...--Gail ShawSQL Server MVP |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-08 : 09:14:51
|
quote: Originally posted by hdew2 i want to modify amount with point ,where 1 point = 10000..ex: amount = 19900 => 19900/10000 = 1 point..just like that..i dont know what the syntax to use it...calling procedure in sql server 2008 in store procedured...the program is made by anyone else..not me...i'm just to modify...n i cannot understand it... sorry about my english...i can speak a little...thank's
so is points stored in some column of table?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-01-09 : 01:46:04
|
| select 19900/10000 will give you 1. If you want decimal points too useselect 1.0*19900/10000MadhivananFailing to plan is Planning to fail |
 |
|
|
hdew2
Starting Member
8 Posts |
Posted - 2012-01-09 : 04:26:41
|
| no, i don't want to use decimal points..n i've already found the syntax.i use int..n then coming error like that : 'run time error 94 : invalid use of null'when i debug : vNotes = "** TERIMA KASIH. Total Point sejak " & Format(CLng(Day(CDate(rsSpecialProgram.Fields("PeriodFrom").Value))), "00") & " " & MonthName(Month(CDate(rsSpecialProgram.Fields("PeriodFrom").Value))) & " " & Format(Year(CDate(rsSpecialProgram.Fields("PeriodFrom").Value)), "0000") & " telah mencapai " & Format(CDbl(rsAccumulationNotes.Fields("Point").Value), "##,##0")..i havent' found the error..could you help me please ? |
 |
|
|
hdew2
Starting Member
8 Posts |
Posted - 2012-01-09 : 04:32:11
|
| Public Function GetAccumulationNotes(ByVal CustomerID As Long, ByVal BranchCode As String, Optional PostingDateFrom As Variant, Optional PostingDateTo As Variant) As ADODB.Recordset Dim sSQL As StringsSQL = "SELECT MIN(n.TransactionDate) as TransactionDate, SUM(n.Point) as Point FROM Notes n WHERE n.CustomerID = " & CStr(CustomerID) & " AND n.BranchCode = '" & QuoteStuff(BranchCode) & "' "i think rsAccumulationNotes.fields("Point").Value),"##,##0") is wrong, how to fix it? |
 |
|
|
hdew2
Starting Member
8 Posts |
Posted - 2012-01-09 : 04:40:23
|
| Format(CDbl(rsAccumulationNotes.Fields("Point").Value), "##,##0") = null when i run the application.. how to save amount 19900 / 10000 = 1 ? i'm confused... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-09 : 04:41:43
|
| first check whats CDbl(rsAccumulationNotes.Fields("Point").Value returning------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
hdew2
Starting Member
8 Posts |
Posted - 2012-01-09 : 08:08:04
|
the value is null? what happened? it should be 1 (19900/10000) but the result is null? i'm headache.. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-09 : 08:32:30
|
quote: Originally posted by hdew2 the value is null? what happened? it should be 1 (19900/10000) but the result is null? i'm headache..
check if corresponding operands are getting correct values and also see if you're having some invalid cast specificationOr it can even be due to missing Point fields in recordset rsAccumulationNotes------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|