Results 1 to 2 of 2

Thread: [2008] Operand data type text is not a valid sum operator (SQL SRV 2005)

Threaded View

  1. #1

    Thread Starter
    Frenzied Member Icyculyr's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    1,934

    Resolved [2008] Operand data type text is not a valid sum operator (SQL SRV 2005)

    Can anyone tell me why this error is happening?

    My connection string is correct, my table is called Table2, my Column is called Name, and my data type is 'Text'

    Code:
    vb.net Code:
    1. Dim connection As New SqlConnection("fake_connection_string_for_this_post")
    2.       Dim command As New SqlCommand("SELECT SUM(Name) FROM Table2", connection)
    3.       connection.Open()
    4.       Dim nam As String= CStr(command.ExecuteScalar())
    5.       connection.Close()

    Dim name As String = CStr(command.ExecuteScalar()), is the line it errors on

    The actual error is in the title, but I will repeat it again:

    Operand data type text is not a valid sum operator

    Can anyone help?

    Thanks
    Last edited by Icyculyr; Feb 3rd, 2008 at 02:38 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width