I am very very new to sql server and I am creating a webservice and with the code below I am getting the error above and I am wondering what it is I am doing wrong?
<WebMethod()> _
Public Function GetAddresses(ByVal skip As Integer, ByVal take As Integer) As FuelStop()
Dim resultList = New List(Of FuelStop)()
Using sqlCon As New SqlConnection()
sqlCon.ConnectionString = "Data Source=(local);Initial Catalog=DEV_DB;User ID=*****;Password=**********"
Dim command As New SqlCommand("SELECT * FROM Gas_Stations WHERE Location_Type = 1 AND [ Physical_Address_Street] = @Physical_Address_Street AND [ Physical_Address_Local] = @Physical_Address_Local AND [Physical_Address_State] = @Physical_Address_State AND [ Physical_Address_Zip] = @Physical_Address_Zip AND [ Phone_Number] = @Phone_Number")
command.Parameters.Add("@Physical_Address_Street", SqlDbType.VarChar, 50, "Physical_Address_Street")
command.Parameters.Add("@Physical_Address_Local", SqlDbType.VarChar, 50, "Physical_Address_Local")
command.Parameters.Add("@Physical_Address_State", SqlDbType.VarChar, 50, "Physical_Address_State")
command.Parameters.Add("@Physical_Address_Zip", SqlDbType.VarChar, 50, "Physical_Address_Zip")
command.Parameters.Add("@Phone_Number", SqlDbType.VarChar, 50, "Phone_Number")
command.Connection = sqlCon
sqlCon.Open()
Using reader = command.ExecuteReader()
While reader.Read()
Dim addr = New FuelStop()
addr.Physical_Address_Street = reader.GetString(0)
addr.Physical_Address_Local = reader.GetString(1)
addr.Physical_Address_State = reader.GetString(2)
addr.Physical_Address_Zip = reader.GetString(3)
addr.Phone_Number = reader.GetString(4)
resultList.Add(addr)
End While
End Using
End Using
Return resultList.Skip(skip).Take(take).ToArray()
End Function
I am looking to just pull values for the columns listed in the query straight from the database. I need all the address info for display in a android app. This would be a read only situation.