SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2012
    0 Post(s)
    0 Thread(s)

    Exclamation urgent help needed

    hello every one
    i am working on a single page , i am using ext js 4 ,and using grid control .my task is to get data from mssql server and show that data in that ext grid, for this i am using webservice , here is a code of my web service
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web.Services;
    using System.IO;
    using System.Text;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Web;
    using System.Web.Script.Services;
    using System.Web.Script.Serialization;
    using System.Runtime.Serialization;
    namespace JSWorking
        /// <summary>
        /// Summary description for WebService2
        /// </summary>
        [WebService(Namespace = "")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
        // [System.Web.Script.Services.ScriptService]
        public class WebService2 : System.Web.Services.WebService
            HttpContext postedContext = HttpContext.Current;
            [WebMethod (EnableSession = true )]
            [ScriptMethod (ResponseFormat = ResponseFormat .Json ,UseHttpGet = true ,XmlSerializeString = false )]
            public List <Object[]> GetData ( string Name , int PhoneNo , int CellNo , int IDNo , string Advance )
                string strCN = "Data Source=waqas\\sqlexpress2;Initial Catalog=myDB;User Id=waqas;Password=patanahi;";
                SqlConnection CN = new SqlConnection(strCN);
                string strQuery = "Select Name,PhonenO,CellNo,IDNo,Advance from Students";
                SqlCommand cmd = new SqlCommand(strQuery,CN);
                cmd.CommandType = CommandType.Text;
                SqlDataReader reader = cmd.ExecuteReader();
                List<Object[]> myArray = new List<object[]>();
                    while (reader.Read())
                        Object[] values = new Object[reader.FieldCount];
                        int fieldCount = reader.GetValues(values);
                    return myArray;
                catch (Exception ex)
                throw ex;  
                reader.Close ();
                    reader.Dispose ();
                    cmd.Dispose ();
                    CN.Close ();
                    CN.Dispose ();
    now how can i show my data in grid using this webservice , please help me , as i am very new in this

    any help will be greatly appreciated

    Best Regards

    M.Waqas Aslam

  2. #2
    SitePoint Zealot behati's Avatar
    Join Date
    Feb 2012
    Copenhagen, Denmark
    1 Post(s)
    0 Thread(s)
    Is there any particular reason to use WebSource? A standard .NET DataSource should do the trick, and it comes with a simple Wizard in Visual Studio.

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts