3 Replies - 298 Views - Last Post: 26 November 2012 - 09:25 PM Rate Topic: -----

#1 pathllk  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 26-July 11

SUM A TEXT FIELD OF DATABSE

Posted 25 November 2012 - 11:51 AM

Dear Friends I want to sum a text field of Database by the Datatable compute method and use the given below code for that:-

Dim pt As String = MYTABLE2.Compute("sum(payment)", string.empty)



But the above code shows an error i.e. "Invalid usage of aggregate function Sum() and Type: String."

Please friends help me regarding this.
Is This A Good Question/Topic? 0
  • +

Replies To: SUM A TEXT FIELD OF DATABSE

#2 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2241
  • View blog
  • Posts: 9,412
  • Joined: 29-May 08

Re: SUM A TEXT FIELD OF DATABSE

Posted 25 November 2012 - 12:51 PM

What datatype is used for the data element payment? Is it String?
Was This Post Helpful? 0
  • +
  • -

#3 pathllk  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 26-July 11

Re: SUM A TEXT FIELD OF DATABSE

Posted 25 November 2012 - 11:23 PM

View PostAdamSpeight2008, on 25 November 2012 - 12:51 PM, said:

What datatype is used for the data element payment? Is it String?



I use MS Access Database and the datatype for the payment field is string(text)
Was This Post Helpful? 0
  • +
  • -

#4 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: SUM A TEXT FIELD OF DATABSE

Posted 26 November 2012 - 09:25 PM

View Postpathllk, on 26 November 2012 - 12:23 AM, said:

I use MS Access Database and the datatype for the payment field is string(text)

Don't you think it would be a good idea to sum numbers instead of text? After all, what would be the result of "Fred" + "3".
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1