Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Found error, doesn't make sense
Message
From
03/05/2019 12:15:03
 
 
To
03/05/2019 11:04:45
General information
Forum:
C#
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01668386
Message ID:
01668390
Views:
45
>Finally found the line of code that's giving the Build issues and it's:
>
> SqlParameter ReturnMsg = new SqlParameter("@ReturnMessage", SqlDbType.VarChar, size: 200);
>
>Apparently, it doesn't like the ':' after the 'size' keyword.
>
>Oddly enough, it has no issues with the same bleedin' line of code in another program and it's the same bleeding code I see in any kind of documentation for stupid output parameters. I'm not seeing the issue - do another set of eyes see anything wrong with it?

Out of curiosity, it would be interested to know if this approach would work without giving an issue on the size.
Dim loDataParameter As IDbDataParameter = Nothing
Dim loSqlCommand As SqlCommand = Nothing
Dim loSqlDataAdapter As SqlDataAdapter = Nothing
Dim loSqlParameter As SqlParameter = Nothing
Dim loParameters As New Collection

loSqlDataAdapter = New SqlDataAdapter
loSqlCommand = New SqlCommand

loSqlParameter = New SqlParameter()
loSqlParameter.ParameterName = "ReturnMsg"
loSqlParameter.Value = "Your value"
loSqlParameter.SqlDbType = SqlDbType.VarChar
loSqlParameter.Size = 200

loParameters.Add(loSqlParameter)

' Only add the parameters if we have some
If loParameters.Count > 0 Then

   ' For each parameter
   For Each loDataParameter In loParameters
      loSqlCommand.Parameters.Add(loDataParameter)
   Next

End If

loSqlDataAdapter.SelectCommand = loSqlCommand
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform