Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8821061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:45:39+00:00 2026-06-14T05:45:39+00:00

Trying to get pure JSON from .asmx page with SQL calls. Can’t seem to

  • 0

Trying to get pure JSON from .asmx page with SQL calls. Can’t seem to get it. Every post I find is either in c# or not what I’m after. Serialization causes a 1 dimensional array issue. I need to get data from MS access database on my web server for small java app.

<%@ WebService class="GetDBStudent" %>

Imports System.Web
Imports System.Web.Services
Imports System.Xml
Imports System.Web.Services.Protocols
Imports System.Web.Script.Services
Imports System.Data
imports System.Web.Script.Serialization

'<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="com.mcfrsit.GetDBStudent")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public Class GetDBStudent
Inherits System.Web.Services.WebService
Public Class Students
    Public StudentID As String
    Public LastName As String
    Public FirstName As String
    Public Affiliation As String
    Public ClassName As String
    Public DateCompleted As DateTime
End Class

<WebMethod()> _
<ScriptMethod(UseHttpGet:=False, ResponseFormat:=ResponseFormat.Json)> _
Public Function GetArray() As Students()

    ' Create a connection string
    Dim DBConnection As String =        ConfigurationManager.ConnectionStrings("OdbcServices").ToString
    Dim sql As String = "SELECT * FROM ClassRecordsEnrollmentsQry WHERE [Affiliation] = 'DFRS'"
    Dim Conn As New ADODB.Connection()
    Dim rs As New ADODB.Recordset()

    Dim daTitles As New Data.OleDb.OleDbDataAdapter()

    Dim dsTitles As New DataSet("CrossTab")
    Conn.Open(DBConnection, "", "", -1)

    Try
        rs.Open(sql, DBConnection, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockBatchOptimistic, 1)

        daTitles.Fill(dsTitles, rs, "Students")
        'create object array, using row count as upper dim
        Dim objStudents As Students() = New Students(dsTitles.Tables(0).Rows.Count - 1) {}

        'loop through dataset to add data to object array
        Dim intRsCount As Int16
        For intRsCount = 0 To dsTitles.Tables(0).Rows.Count - 1
            Dim intCsCount As Int16
            For intCsCount = 0 To dsTitles.Tables(0).Columns.Count - 1
                'Dim strColName As String = dsTitles.Tables(0).Columns(intCsCount)
            Next
            objStudents(intRsCount) = New Students
            objStudents(intRsCount).StudentID = dsTitles.Tables(0).Rows(intRsCount)(0)
            objStudents(intRsCount).LastName = dsTitles.Tables(0).Rows(intRsCount)(1)
            objStudents(intRsCount).FirstName = dsTitles.Tables(0).Rows(intRsCount)(2)
            objStudents(intRsCount).Affiliation = dsTitles.Tables(0).Rows(intRsCount)(3)
            objStudents(intRsCount).ClassName = dsTitles.Tables(0).Rows(intRsCount)(4)
            objStudents(intRsCount).DateCompleted = dsTitles.Tables(0).Rows(intRsCount)(5)
        Next

        'Return new JavaScriptSerializer().Serialize(objStudents)
        Return objStudents

    Catch ex As Exception
        'Response.Write("Sorting is not supported in the view")
    Finally
        Conn.Close()
    End Try
End Function


End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:45:41+00:00Added an answer on June 14, 2026 at 5:45 am

    Solved: Returned Function as Object and worked fine…

    However the JSON string returned looks like:

    [{"text":"text2"}]
    

    Why the extra “[” and “]” at the start and end?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to get a result from pyparsing as a pure list so
I'm trying get the visible portion of UIImage from an UIImageView . UIImageView takes
Trying to get this expression to work, can someone look at it and tell
I'm trying to get with a simple SQL statement the IP address of the
I am trying to get all css link from html like this segment of
Trying to get close a W3C validation of the output from my aspx (VB.NET
I am trying to get started with pure TDD and also consider the BDD
I'm trying to get data from a webpage that serves a XML file periodically
Been trying to get a pure css dropdown been trying for days to get
I am trying to get my div to fade out using pure CSS. But

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.