Hi Friends,
please help me on following code as I want to get account_no in first search autocompletelist based on return value from first search, I want to get Description in second search. so first search working fine , but second search not return value.
thank you. regards, asad
First Search
<System.Web.Script.Services.ScriptMethod(), _
System.Web.Services.WebMethod()> _
Public Shared Function search_accountno(ByVal prefixText As String, ByVal count As Integer) As List(Of String)
Dim conn As SqlConnection = New SqlConnection
conn.ConnectionString = ConfigurationManager _
.ConnectionStrings("SQLConnection").ConnectionString
Dim cmd As SqlCommand = New SqlCommand
cmd.CommandText = "select account_no from coa where" & _
" account_no like @SearchText + '%'"
cmd.Parameters.AddWithValue("@SearchText", prefixText)
cmd.Connection = conn
conn.Open()
Dim account_no As List(Of String) = New List(Of String)
Dim sdr As SqlDataReader = cmd.ExecuteReader
While sdr.Read
account_no.Add(sdr("account_no").ToString)
End While
conn.Close()
Return account_no
End Function
Second search
<System.Web.Script.Services.ScriptMethod(), _
System.Web.Services.WebMethod()> _
Public Shared Function Searchaccount(ByVal account_no As String, ByVal count As Integer) As List(Of String)
Dim conn As SqlConnection = New SqlConnection
conn.ConnectionString = ConfigurationManager _
.ConnectionStrings("SQLConnection").ConnectionString
Dim cmd As SqlCommand = New SqlCommand
cmd.CommandText = "select description from coa where" & _
" account_no like prefixText + '%'"
cmd.Parameters.AddWithValue("account_no", account_no)
cmd.Connection = conn
conn.Open()
Dim accno As List(Of String) = New List(Of String)
Dim sdr As SqlDataReader = cmd.ExecuteReader
While sdr.Read
accno.Add(sdr("account_no").ToString)
End While
conn.Close()
Return accno
End Function