<%@ Import Namespace=”System.Data.OleDb” %> <% Response.AppendHeader(“Access-Control-Allow-Origin”, “*”) Response.AppendHeader(“Content-type”, “application/json”) Dim conn As New OleDbConnection(“Provider=Microsoft.Jet.OLEDB.4.0;data source=Northwind.mdb”) Dim objAdapter As New OleDbDataAdapter(“SELECT CompanyName, City, Country FROM Customers”, conn) Dim objDataSet As New DataSet() objAdapter.Fill(objDataSet, “myTable”) Dim outp As String = “” Dim c As String = Chr(34) For Each x In objDataSet.Tables(“myTable”).Rows If outp <> “” Then outp &= “,” outp &= “{” & c & “Name” & c & “:” & c & x(“CompanyName”) & c & “,” & _ c & “City” & c & “:” & c & x(“City”) & c & “,” & _ c & “Country” & c & “:” & c & x(“Country”) & c & “}” Next Response.Write(“{” & c & “records” & c & “:[” & outp & “]}”) conn.Close() |