Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>FAO CodeSleuth (and anyone else needing this).</p> <p>Thanks to you, and you helping me 'understand' the problem, I now have it working.</p> <p>My own code is as follows:</p> <pre><code> Function GetEvents(ByVal [start] As Double, ByVal [end] As Double) As JsonResult Dim sqlConnection As New SqlClient.SqlConnection sqlConnection.ConnectionString = My.Settings.sqlConnection Dim sqlCommand As New SqlClient.SqlCommand sqlCommand.CommandText = "SELECT tripID AS ID, tripName AS Title, dateStart AS [Start], dateEnd AS [End] FROM tblTrip WHERE userID=18 AND DateStart IS NOT NULL" sqlCommand.Connection = sqlConnection Dim ds As New DataSet Dim da As New SqlClient.SqlDataAdapter(sqlCommand) da.Fill(ds, "Meetings") sqlConnection.Close() Dim meetings = From c In ds.Tables("Meetings") Select {c.Item("ID"), c.Item("Title"), "False", c.Item("Start"), c.Item("End"), "False"} Dim meetingsArray As New ArrayList() For Each dr As DataRow In ds.Tables("Meetings").Rows Dim m As New Meeting With m .AllDay = False .End = CDate(dr.Item("End")).ToJson() .ID = dr.Item("ID") .Start = CDate(dr.Item("Start")).ToJson() .Title = dr.Item("Title") End With meetingsArray.Add(m) Next Return Json(meetingsArray, JsonRequestBehavior.AllowGet) End Function </code></pre> <p>and the following class definition:</p> <pre><code>Public Class Meeting Public id As Integer Public title As String Public start As String Public [end] As String Public allDay As Boolean </code></pre> <p>End Class</p> <p>and the following function, again thanks to you:</p> <pre><code>Public Module DateTimeExtensionMethods Sub New() End Sub &lt;System.Runtime.CompilerServices.Extension()&gt; _ Public Function ToJson(ByVal dateTime As DateTime) As String Return dateTime.ToString("s") End Function </code></pre> <p>End Module</p> <p>That works perfectly, although I do need to tweak it slightly to read from the Linq results (or simply change the SQL Command to filter).</p> <p>Again, many thanks for helping me understand the problem, I'm a firm believer that one needs to understand and now just copy code and your help has done that.</p> <p>Jason</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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