emaduddeen
Well-known member
- Joined
- May 5, 2010
- Messages
- 171
- Location
- Lowell, MA & Occasionally Indonesia
- Programming Experience
- Beginner
Hi Everyone,
Can you tell me how to handle processing when parameter.add adds a parameter in which the value is null or empty?
In my code I add this parameter:
When this line executes I get an error that states @parameter has no default value.
Ok, well at least I thought I had it covered in here but I must be missing something:
I thought that String = Nothing gives them a default value.
As a quick fix so I can import the data I made sure if any parameter was null I would pass it a single space character but is that the best way to handle that scenario?
Thanks.
Truly,
Emad
Can you tell me how to handle processing when parameter.add adds a parameter in which the value is null or empty?
In my code I add this parameter:
VB.NET:
objCommand.Parameters.Add(New OleDbParameter("@parameter7", pParameter7))
When this line executes I get an error that states @parameter has no default value.
VB.NET:
objCommand.ExecuteNonQuery()
Ok, well at least I thought I had it covered in here but I must be missing something:
VB.NET:
Public Function ExecuteInsertChangeDelete(ByVal pSqlQuery As String,
Optional ByVal pParameter1 As String = Nothing,
Optional ByVal pParameter2 As String = Nothing,
Optional ByVal pParameter3 As String = Nothing,
Optional ByVal pParameter4 As String = Nothing,
Optional ByVal pParameter5 As String = Nothing,
Optional ByVal pParameter6 As String = Nothing,
Optional ByVal pParameter7 As String = Nothing,
Optional ByVal pParameter8 As String = Nothing,
Optional ByVal pParameter9 As String = Nothing,
Optional ByVal pParameter10 As String = Nothing
) As Boolean
I thought that String = Nothing gives them a default value.
As a quick fix so I can import the data I made sure if any parameter was null I would pass it a single space character but is that the best way to handle that scenario?
Thanks.
Truly,
Emad
Last edited: