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 8017103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:44:33+00:00 2026-06-04T20:44:33+00:00

i build a web service with Visual Studio 2010. the Language is C# and

  • 0

i build a web service with Visual Studio 2010. the Language is C# and ASP.NET 3.5.

the Webserver sends the data from my ms sql server 2008 to an iPhone with JSON format.

but i receive one string value with all the data from SQL Server.
i want that the web service sends me the data separate so that i can consume it better on the iPhone.

here is my c# class:

   namespace WebService1
{
    public class RaumklassenHelper
    {



        internal static string Raumklasse()
        {
            string raumKlassenObject = "";

            using (SqlConnection con = new SqlConnection(@"Data Source=Localhost\SQLEXPRESS;Initial Catalog=BOOK-IT-V2;Integrated Security=true;"))
            using (SqlCommand cmd = new SqlCommand(@"SELECT BEZEICHNUNG FROM RAUMKLASSE", con))
            {

                con.Open();
                using (SqlDataReader rdr = cmd.ExecuteReader())
                {


                    while (rdr.Read())
                    {
                        if (rdr["BEZEICHNUNG"]  != DBNull.Value)
                         {

                              raumKlassenObject += rdr["BEZEICHNUNG"].ToString();
                         }

                    }


                }
            }

            return raumKlassenObject;
        }
    }
}

here is my web method:

[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        [WebMethod]
        public string Raumklasse()
        {
            return RaumklassenHelper.Raumklasse();
        }

how can send the strings spereate ?

  • 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-04T20:44:36+00:00Added an answer on June 4, 2026 at 8:44 pm

    You could return an array:

    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    [WebMethod]
    public string[] Raumklasse()
    {
        return RaumklassenHelper.Raumklasse();
    }
    

    and then obviously adapt the data retrieval method:

    public class RaumklassenHelper
    {
        internal static string[] Raumklasse()
        {
            List<string> raumKlassenObject = new List<string>();
    
            using (SqlConnection con = new SqlConnection(@"Data Source=Localhost\SQLEXPRESS;Initial Catalog=BOOK-IT-V2;Integrated Security=true;"))
            using (SqlCommand cmd = new SqlCommand(@"SELECT BEZEICHNUNG FROM RAUMKLASSE", con))
            {
                con.Open();
                using (SqlDataReader rdr = cmd.ExecuteReader())
                {
                    while (rdr.Read())
                    {
                        if (rdr["BEZEICHNUNG"] != DBNull.Value)
                        {
                            raumKlassenObject.Add(rdr["BEZEICHNUNG"].ToString());
                        }
                    }
                }
            }
            return raumKlassenObject.ToArray();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I built a .NET ASMX web service connecting to an SQL Server database. There
I have a web service running on machine A on Visual Studio's build-in Development
I'm in the process of migrating a VB.NET web application from Visual Studio 2005
Say you have a SQL Server 2008 database. You build a SOAP web service.
I want to build web service with Visual studio and run it for testing
My friend build a web service in java I build one in .net I
We have build several web service based on .net. Now we want to create
I am using Maven, Jersey and Jetty server to build a web service interface.
In Visual Studio 2010 I created a new Ajax enabled WCF Service [ServiceContract(Namespace =
I have a Visual Studio 2010 solution that is set to build in Debug

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.