TSCAmerica.com
TSCAmerica.com

Reputation: 5377

Trying to Convert a PHP code to VB.net

MY PHP Code is

$geourl = 'http://maps.google.com/maps/geo?key=' . $google_apikey . 
    '&output=json'. '&q=' . urlencode($_GET['url'] . ', USA').'&gl=us';

My ASPX code looks like this

Dim google_apikey As String="sdasdasd"    
Dim geourl As String= "http://maps.google.com/maps/geo?key=" & google_apikey & _
   "&output=json" & "&q=" & urlencode(request.QueryString("pc")& ", USA")"&gl=us"

The Error i get is Compiler Error Message: BC30205: End of statement expected.

Instead of Period (.) i have used & is it valid in vb.net, what is the problem with the above string, urlencode ?

Upvotes: 0

Views: 1007

Answers (2)

kufudo
kufudo

Reputation: 2833

Think you missed a concatenator right at the end. Should it be:

Dim geourl As String= "http://maps.google.com/maps/geo?key=" & google_apikey & _
     "&output=json" & "&q=" & UrlEncode(request.QueryString("pc")& ", USA") & _
     "&gl=us"

Upvotes: 1

Darin Dimitrov
Darin Dimitrov

Reputation: 1038810

I would recommend you using the String.Format method to make your code more readable:

Dim google_apikey As String="sdasdasd"    
Dim geourl As String = String.Format("http://maps.google.com/maps/geo?key={0}&output=json&q={1},USA&gl=us", UrlEncode(google_apikey), UrlEncode(Request.QueryString("pc")))

Upvotes: 0

Related Questions