I need to return a list of Adresses from a asp.net webservice to a Android app -
i creating webservice on asp.net using vb. webservice addresses sql server 2008 database , return android platform. far have code database connection , open it. how can return list of addresses in database? can webservice return entries in specified database?
public class service1 inherits system.web.services.webservice <webmethod()> _ public function getaddresses() fuelstop() dim sqlcon new sqlconnection dim resultlist = new list(of fuelstop)() try sqlcon.connectionstring = "data source=google.watersports.com;initial catalog=mydb;persist security info=true;connect timeout=30;user id=****;password=******" dim command new sqlcommand("select @physical_address_street, @physical_address_local, @physical_address_state, @physical_address_zip, @phone_number gas_stations location_type = 1") command.parameters.add("@physical_address_street", sqldbtype.varchar, 50).value = "physical_address_street" command.parameters.add("@physical_address_local", sqldbtype.varchar, 50).value = "physical_address_local" command.parameters.add("@physical_address_state", sqldbtype.varchar, 50).value = "physical_address_state" command.parameters.add("@physical_address_zip", sqldbtype.varchar, 50).value = "physical_address_zip" command.parameters.add("@phone_number", sqldbtype.varchar, 50).value = "phone_number" command.connection = sqlcon sqlcon.open()
and far fuel stop class have
public class fuelstop property physical_address_street string property physical_address_local string property physical_address_state string property physical_address_zip string property phone_number string end class
hmmm think you're on complicating things try this:
public function getaddresses() fuelstop() dim sqlcon new sqlconnection dim resultlist = new list(of fuelstop)() try sqlcon.connectionstring = "data source=google.watersports.com;initial catalog=mydb;persist security info=true;connect timeout=30;user id=****;password=******" dim command new sqlcommand("select physical_address_street, physical_address_local, physical_address_state, physical_address_zip, phone_number gas_stations location_type = 1") command.connection = sqlcon sqlcon.open()
Comments
Post a Comment