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

  • SEARCH
  • Home
  • 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 8769585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:22:41+00:00 2026-06-13T17:22:41+00:00

So, recently I’ve been looking into the HTML5 Indexeddb feature which is controlled with

  • 0

So, recently I’ve been looking into the HTML5 Indexeddb feature which is controlled with Javascript, and how to incorporate this with an SQL Server database to share and copy information across so that a version of the database is available offline.

The conundrum that I have is finding the best way to pass a set of objects from an SQL Server database through to the javascript of a browser, using C# to get the values from the database.

Though there are many little “hacks” that can be done (e.g Putting data into labels and then having the Javascript just pick it up document.getElementById(“DataHere”).value;) I was wondering if there were more efficient ways of passing the contents of a database across?

At the moment I have a method that generates an array of strings (all in the JSON format, using the JSON.Net package) as an example of what would be returned from the database.

    public string[] GenerateEmployeeSample() {
    List<Employee> listEmps = new List<Employee>();
    string[] listJSON = new string[64];
    string[] FirstNames = {"Alonso", "Alfred", "Angus", "Alfresco" };
    string[] LastNames = {"Johnson","Williams", "Zelwegger", "Jones" };
    string[] Departments = {"Finance", "Cleaning", "Pusher", "Stairs" };
    string emailEnd = "@email.com";

    for (int i = 0; i < 4; i++) {
        for (int j = 0; j < 4; j++) {
            for (int k = 0; k < 4; k++) {
                Employee tempEmp = new Employee();
                tempEmp.FirstName = FirstNames[i];
                tempEmp.LastName = LastNames[j];
                tempEmp.Department = Departments[k];
                tempEmp.Email = FirstNames[i] + "." + LastNames[j] + emailEnd;
                listEmps.Add(tempEmp);
            }
        }
    }
    int count = 0;
    foreach(Employee emp in listEmps){
        string tempString = JsonConvert.SerializeObject(emp);
        listJSON[count] = tempString;
        count++;
    }

    return listJSON;
}

So now I have a set of data, how would I be able to pass this array through to Javascript?
I apologise if this is a trivial question but Javascript is still rather new to me, and after reading through quite a few examples that either didn’t do what I wanted or just outright didn’t work I am at a bit of a loss.

Thanks very much for reading!

  • 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-13T17:22:42+00:00Added an answer on June 13, 2026 at 5:22 pm

    To be more specific, you would make a resource (be it an aspx page or or a json file etc) that returns a JSON string when requested. You’re already partway there with this step, because you’ve already got the code for serializing objects as JSON. A simple way of doing this would be to have a page that outputs the return value of this function using Response.Write(GenerateEmployeeSample());

    Then you would use the XMLHttpRequest object to request this resource, and parse the returned JSON using javascript’s JSON.parse, which returns a native javascript object. You may then do with this object as you please.

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

Sidebar

Related Questions

Recently I've been thinking about how to transform a complex polygon into a non-complex
Recently just upgraded to SQL Server 2008 R2 Express. When I attempt to create
Recently I've been doing things like this: import Tkinter class C(object): def __init__(self): self.root
Recently, I started changing some of our applications to support MS SQL Server as
Recently our site has been deluged with the resurgence of the Asprox botnet SQL
Recently I ran into this error in my web application: java.lang.OutOfMemoryError: PermGen space It's
Recently I was asked to develop an app, which basically is going to use
Recently, I was writing a class in which I discovered that I could reduce
Recently I have released my app into the US AppStore. Now I Planed for
recently, while working on a db2 -> oracle migration project, we came across this

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.