Note that there are some explanatory texts on larger screens.

plurals
  1. POWeb services error I found the error in web services
    text
    copied!<p>These method in AutoComplete.asmx</p> <pre><code>[WebMethod] public List&lt;string&gt; GetCountries(string prefixText) { SqlConnection con = new SqlConnection( ConfigurationManager.ConnectionStrings[ "MarinaNewConnectionString"].ToString()); con.Open(); SqlCommand cmd = new SqlCommand( "select * from Marina where Country like @Name+'%'", con); cmd.Parameters.AddWithValue("@Name", prefixText); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); List&lt;string&gt; CountryNames = new List&lt;string&gt;(); for(int i=0;i&lt;dt.Rows.Count;i++) { CountryNames.Add(dt.Rows[i][5].ToString()); } return CountryNames; } </code></pre> <p>I found the error </p> <blockquote> <p>System.InvalidOperationException: There was an error generating the XML document. ---></p> <p>System.InvalidCastException: Unable to cast object of type </p> </blockquote> <p>EDIT: </p> <p>The SQL for the table:</p> <pre><code>CREATE TABLE [dbo].[Marina]( [SNo] [int] IDENTITY(1,1) NOT NULL, [WebSource] [varchar](500) NULL, [MarinaName] [varchar](500) NULL, [Region] [varchar](500) NULL, [Address] [varchar](500) NULL, [Country] [varchar](500) NULL, [fax] [varchar](500) NULL, [Phone] [varchar](500) NULL, [Email] [varchar](500) NULL, [Website] [varchar](500) NULL, [latitude] [varchar](500) NULL, [langitude] [varchar](500) NULL, [NumberOfMoorings] [varchar](500) NULL, [MGiD] [varchar](500) NULL, [Association] [varchar](200) NULL, ) ) ON [PRIMARY] </code></pre> <p>The StackTrace:</p> <blockquote> <p>System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidCastException: Unable to cast object of type 'System.Collections.Generic.List`1[System.String]' to type 'System.String[]'. at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write3_Arr‌​ayOfString(Object o) at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfStringSerializer1.Serialize(‌​Object objectToSerialize, XmlSerializationWriter writer)</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload