Error Message: Cannot implicitly convert type 'System.Collections.Generic.List<string>' to 'string[]'
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class Frm_Grid : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
//public string ID { get; set; }
[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
public static string[] SearchCustomers(string prefixText, int count, string contextKey)
{
using (SqlConnection conn = new SqlConnection())
{
conn.ConnectionString = ConfigurationManager
.ConnectionStrings["con"].ConnectionString;
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "select V_PONo from tbl_Genrate_PO where " +
"V_PONo like @SearchText + '%'";
cmd.Parameters.AddWithValue("@SearchText", prefixText);
cmd.Connection = conn;
conn.Open();
List<string> customers = new List<string>();
using (SqlDataReader sdr = cmd.ExecuteReader())
{
while (sdr.Read())
{
customers.Add(sdr["V_PONo"].ToString());
}
}
conn.Close();
return customers;
}
}
}
}