It has been way to long since I have been involved in VB so I need some help here. I have the following in my C# code
SqlParameter[] param = new SqlParameter[0];
...some code...
param = new SqlParameter[2];
param[0] = db.MakeInputParameter("@group_id", groupid);
param[1] = db.MakeInputParameter("@organization_id", orgid);
The reason i do not initialize the size firstly is because i reuse the param variable in the same method, just in case you were wondering
The following is what I have tried but I keep getting that the variable is used before I assign a value
Dim param() As SqlParameter
...some code...
param(2) = New SqlParameter
param(0) = db.MakeInputParameter("@group_id", groupid)
param(1) = db.MakeInputParameter("@organization_id", orgid)
How do I convert this type of logic to VB.Net
Use ReDim
Dim param() As SqlParameter
Redim param(1) 'The value VB.NET array subscript uses upper-bound.
Or
param = New SqlParameter(1) {}