User-1767698477 posted
I have tried this several ways, and for some reason the values which are returned correctly from the 72k row database are uppercase. The vbpropercase is not working. Are the values retured from the reader strings? I tried to convert to string to insure StrConv
works but it had no affect.
Protected Sub btngetcounty_Click(sender As Object, e As EventArgs) Handles btngetcounty.Click
Dim cn As New SqlConnection(ConfigurationManager.ConnectionStrings("sqlConnectionString").ConnectionString)
Dim selectquery As String = "select City, County from [USZipCodes] where ZipCode =@Zipcode"
Dim cmdselect As New SqlCommand(selectquery, cn)
cmdselect.Parameters.Add(New SqlParameter("@Zipcode", Txtpropertyzip.Text))
cmdselect.CommandType = System.Data.CommandType.Text
cmdselect.Connection = cn
cn.Open()
Dim City As String = ""
Using reader = cmdselect.ExecuteReader()
While reader.Read()
City = reader.GetString(0).ToString
StrConv(City, vbProperCase)
txtpropertycity.Text = City
txtpropertycounty.Text = reader.GetString(1).ToString
StrConv(txtpropertycounty.Text, vbProperCase)
End While
End Using
cn.Close()
End Sub