troubleshooting Question

Convert VB to C#

Avatar of digitalwise
digitalwise asked on
.NET ProgrammingC#
17 Comments1 Solution74 ViewsLast Modified:
We have this old code from an ASP website that we are moving over to ASP.NET C# - we are trying to make minimal changes to the old pages since it wasn't part of the contract but we need to swap this out to C# since all of the new stuff is in it.   I have part of it but not the loop piece.

Old code
 For a = 1 to Request.Form("propertyid").Count
strSQL = "Insert into property_assign (assigned_to, propertyid) VALUES ("
strSQL = strSQL & "'" & Request.Form("assigned_to") & "',"
strSQL = strSQL & "'" & Request.Form("propertyid")(a) & "')"

The start of my new code:
foreach (var Properties in Request("propertyid")) { 
            sql2 = "Insert into property_assign (assigned_to, propertyid) VALUES (@0, @1)";
            db.Execute(sql2, Request.Form("username"), Properties.propertyid);

I get Non-invocable member 'WebPageRenderingBase.Request' cannot be used like a method.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 17 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 17 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros