I have the following code:

```
_sql += "SELECT [CodeListNumber] as '@Number'"
_sql += "      ,[ShortDescription]"
_sql += "      ,[ExpiryDate]"
_sql += "      ,[CompositeCode]"
_sql += "  FROM [Aviva_Guidewire_Dev_V3].[dbo].[Aviva_CompleteCodeList] as [CodeListNumber]"
_sql += "  order by [CodeListNumber]"
_sql += "  for xml path('CodeList'), root('CodeLists'), elements"

Dim params As String()
Dim _Rtn As String = _dbRoot.Database.ExecuteSqlCommand(_sql, params)
Dim _xDoc As New XmlDocument
_xDoc.LoadXml(_Rtn)

```

If I run the above SQL statement directly in SSMS, it returns a value called XML\_[some guid].

When I run the code within VS 2012, the value \_Rtn is -1 and that is all I get. I can see that ExecuteSQLCommand can have a parms array, but am not sure what I should be doing in this case.

Should I change the code to be a stored proc and just call it?

Or can someone show me how to create the same code using Linq to Entities, or Linq to SQL.

Thanks