|
-
Sep 21st, 2006, 04:02 PM
#1
Thread Starter
New Member
Syntax error converting the varchar value
Error: Syntax eror conerting the varchar value '[12] FirstName LastName' to a column of data type int
Codebits:
****************
' Declare the protected objects
Protected WithEvents drpSalesman As DropDownList
Protected WithEvents txtDate As TextBox
Protected WithEvents txtAmount As TextBox
Protected WithEvents lblDebug As Label
Protected WithEvents pnlForm As Panel
Protected WithEvents pnlConfirm As Panel
Protected WithEvents pnlDone As Panel
Protected WithEvents lblSalesman As Label
Protected WithEvents lblDate As Label
Protected WithEvents lblAmount As Label
'Gobal Vars
Public conSQL As New SqlConnection( ConfigurationSettings.AppSettings( "ConnectionString" ) )
Public cmdSQL As SqlCommand
Public dtrSQL As SqlDataReader
************
Sub SendSMS()
Dim strSQL As String = ""
Dim strMessage As String = ""
strMessage &= "Compliance: " & drpSalesman.SelectedItem.Text & " $ " & String.Format("{0:#,###}", CInt(txtAmount.Text)) & vbCrLf
'''''''''''''''''''''''''''''''''''''''
'Saleperson Day Total
'''''''''''''''''''''''''''''''''''''''
strSQL = "SELECT "
strSQL &= "SUM(amount) as total "
strSQL &= "FROM "
strSQL &= "SB_data as sb "
strSQL &= "WHERE user_id = '" & drpSalesman.SelectedItem.Value & "' AND datestamp > '" & Now.ToString("d") & "' "
conSQL.Open()
cmdSQL = New SqlCommand(strSQL, conSQL)
dtrSQL = cmdSQL.ExecuteReader()
Line 160 If dtrSQL.Read() Then
strMessage &= drpSalesman.SelectedItem.Value & " Day Total: $ " & String.Format("{0:#,###}", dtrSQL("total")) & vbCrLf
End If
dtrSQL.Close()
conSQL.Close()
*****************
Line 160 is where the error is reported to occur.
Any help with this would be greatly appreciated.
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
|