-
SqlString Not Allowed with & in string
I found that when I use this same routine where the values are As String the string for the SQL is fine but when I change it to As SqlString I get an error
Error 1 Operator '&' is not defined for types 'String' and 'System.Data.SqlTypes.SqlString'
How do I create a string with a set of SQL parms where one of the values may be a SqlString since I may pass a Null.
Public Sub Clear_TDNTRKDLM(ByRef Clr_TRK_SalesLocation As SqlString, _
ByRef Clr_TRK_SubSalesLocation As SqlString)
'
On Error GoTo Clear_TDNTRKDLM_Error
'
Dim strDELETE_SQL As String
'
strDELETE_SQL = "DELETE TDNTRKMAS " & _
"WHERE KMLOC = " & Clr_TRK_SalesLocation
cnn.Execute(strDELETE_SQL)
'
Clear_TDNTRKDLM_Exit:
Exit Sub
'
Clear_TDNTRKDLM_Error:
'Call GeneralErrorRoutine(Err, "Clear_TDNTRKDLM")
Resume Next
'
End Sub
-
I have never, ever used Sqlstring for a variable which contains a query.
What is the issue with sticking with As String?
-
I used because the returning value from the DB can be Null. In the string case the code passes thru the error routine and keeps going. Big question was why it had an issue with the &.
-
Try using + instead of &. + is the standard concatenation operator for SQL, although it will probably raise an error since your appending it to a string. Can't you eliminate the Nulls when retrieving the SqlString value?
 Originally Posted by Don
I found that when I use this same routine where the values are As String the string for the SQL is fine but when I change it to As SqlString I get an error
Error 1 Operator '&' is not defined for types 'String' and 'System.Data.SqlTypes.SqlString'
How do I create a string with a set of SQL parms where one of the values may be a SqlString since I may pass a Null.
Public Sub Clear_TDNTRKDLM(ByRef Clr_TRK_SalesLocation As SqlString, _
ByRef Clr_TRK_SubSalesLocation As SqlString)
'
On Error GoTo Clear_TDNTRKDLM_Error
'
Dim strDELETE_SQL As String
'
strDELETE_SQL = "DELETE TDNTRKMAS " & _
"WHERE KMLOC = " & Clr_TRK_SalesLocation
cnn.Execute(strDELETE_SQL)
'
Clear_TDNTRKDLM_Exit:
Exit Sub
'
Clear_TDNTRKDLM_Error:
'Call GeneralErrorRoutine(Err, "Clear_TDNTRKDLM")
Resume Next
'
End Sub
...joe
Similar Threads
-
By Martin in forum VB Classic
Replies: 22
Last Post: 12-03-2001, 04:53 AM
-
By Fred Mayes in forum Java
Replies: 1
Last Post: 06-05-2001, 06:12 AM
-
By Chandra in forum VB Classic
Replies: 0
Last Post: 06-22-2000, 12:52 PM
-
By chandra in forum VB Classic
Replies: 0
Last Post: 06-22-2000, 07:36 AM
-
By Chandra in forum VB Classic
Replies: 0
Last Post: 06-22-2000, 07:30 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
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|