i have following code
while updating service i m getting an errorCode: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] } }


Reply With Quote