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




Reply With Quote