|
-
Feb 3rd, 2008, 12:30 AM
#1
Thread Starter
Frenzied Member
[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:
Dim connection As New SqlConnection("fake_connection_string_for_this_post")
Dim command As New SqlCommand("SELECT SUM(Name) FROM Table2", connection)
connection.Open()
Dim nam As String= CStr(command.ExecuteScalar())
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.
-
Feb 3rd, 2008, 02:37 AM
#2
Thread Starter
Frenzied Member
Re: [2008] Operand data type text is not a valid sum operator (SQL SRV 2005)
Fixed it, the SQL syntax was wrong, it had SUM(Name) instead of just (Name) in the code
Cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|