i've got an autocomplete extender linked to a sql table, the code below is working fine and brings back the correct data, my problem is that it is adding a final array item of null and i know for certain that there are no null values in my table. anyone got any ideas on why it's returning this null value everytime, is there a problem with my array? if anyone is trying to get autocomplete working with sql and needs some example code just give me a shout, thanks in advance for any help
Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As String()
Dim sql As String = "Select * from x where y like @prefixText"
Dim da As SqlDataAdapter = New SqlDataAdapter(sql, Connection)
da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText + "%"
Dim dt As DataTable = New DataTable()
da.Fill(dt)
Dim items() As String = New String(dt.Rows.Count) {}
Dim i As Integer = 0
Dim dr As DataRow
For Each dr In dt.Rows
items.SetValue(dr("z").ToString(), i)
i = i + 1
Next
Return items
End Function