KB Issue
Programming in VB.NET or C#, which do we use, parenthesis or brackets?
Issue Details
When crossing over from one programming language to another, in this case, we are working on both VB.NET and C#; we are bound to run into issues. When wrapping our variable names, it can be tricky when you go between the two languages and forget which one you are working in.
Recreate Issue
In VB.NET, we use the parentheses GetName(v). However, that is not the case for C#.
In this example, we have a mixture of both V.NET and C#, but we can only use one language.
[Scenario #1]

Response.Write(getFile + "(" + GetName(v) + ") Uploaded Successfully!<br />")
Copy
Search Site
Search Google
[Scenario #2]

(C#) In this example, the recordset is not formatted correctly for C#. The only change in this line of code to make it C# is the semicolon at the end. That is not all that is needed; we can see this from the error.
String strTag = rsTag("TagName");
Copy
Search Site
Search Google
Resolve Issue
We need to change the parentheses to brackets in C#.
The uses of both C# and VB.NET are demonstrated below.
[Scenario #1]
[VB]

Response.Write(getFile & "(" & GetName(v) & ") Uploaded Successfully!<br />")
Copy
Search Site
Search Google
[C#]

Response.Write(getFile + "(" + GetName[v] + ") Uploaded Successfully!<br />");
Copy
Search Site
Search Google
[Scenario #2]
[C#]
Adding (string) to the beginning and brackets around our Column Names will resolve this issue.
String strTag = (string)rsTag["TagName"];
Copy
Search Site
Search Google