Results 1 to 4 of 4

Thread: Error in Updating service

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2007
    Location
    Karachi
    Posts
    551

    Error in Updating service

    i have following code

    Code:
    using System.Data;
    using System.Data.SqlClient;
    using System;
    using System.Linq;
    using System.Runtime.Serialization;
    using System.ServiceModel;
    using System.ServiceModel.Activation;
    using System.Collections.Generic;
    using System.Text;
    
    namespace VotingPanel.Web
    {
        [ServiceContract]  
        public interface Iservice1
        {
            [OperationContract]
            List<Vote> GetChartData();
    
            
        }
     [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    //    [ServiceContract]
        public class Service1 : Iservice1
        {
    
            
            SqlConnection Conn;
            SqlCommand Cmd;
    
            
            # region Iservice1 members
            [OperationContract]
            public List <Vote> GetChartData()
    
        {
           DataClasses1DataContext db = new DataClasses1DataContext();
           var query = from c in db.Votes select c;
           return query.Take(10).ToList();
            }
          # endregion
           
           
           [OperationContract]
    
            public void Insertdata(String vote, DateTime dt) 
            {
                Conn = new SqlConnection("Data Source=IRAM-PC;Initial Catalog=Voting;User Id=sa;Password=sa;Integrated Security=SSPI");
                Cmd = new SqlCommand();
                Conn.Open();
                Cmd.Connection = Conn;
                Cmd.CommandText = "insert into votes values  ('" + vote + "', '"+dt+"' )";
    
               
                int ins = Cmd.ExecuteNonQuery();
                //if (ins > 0) 
                //{ 
                //    Inserted = true; 
                //} 
    
                Conn.Close(); 
            }
            public void GetData()
            {
                bool Inserted = false;
                Conn = new SqlConnection("Data Source=IRAM-PC;Initial Catalog=Voting;User Id=sa;Password=sa;Integrated Security=SSPI");
                Cmd = new SqlCommand();
                Conn.Open();
                Cmd.Connection = Conn;
                Cmd.CommandText = "SELECT votingtext, COUNT(Votingtext) AS count FROM votes group by Votingtext";
               
               
                int ins = Cmd.ExecuteNonQuery();
                if (ins > 0)
                {
                    Inserted = true;
                }
    
                Conn.Close();
                //return Inserted;
            } 
    
        
       
    
            // Add more operations here and mark them with [OperationContract]
            }
    }
    while updating service i m getting an error
    Attached Images Attached Images  
    There is no achievement without goals

Posting Permissions

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



Click Here to Expand Forum to Full Width