Results 1 to 2 of 2

Thread: Problem in inserting data using Silverlight

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Posts
    270

    Problem in inserting data using Silverlight

    Hell to every body on Vbforums,
    By using Follwoing code i tried to insert data in database in silverlight

    Code:
     Service1Client webservice = new Service1Client();
                //ServiceReference1Client  webservice = new ();
                bool b;
                b = webservice.InsertVoteAsync ("Abc", DateTime.Now.Date);

    and the service code is

    Code:
    [OperationContract]
            public bool InsertVote1(String vote, DateTime  dt) 
           { 
               bool Inserted = false;
               Conn = new SqlConnection("Data Source=xyz-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(); 
               return Inserted; 
           }
    but gives me these errors


    Error 1 The best overloaded method match for 'VotingPanel.ServiceReference1.Service1Client.InsertVoteAsync(System.DateTime, string)' has some invalid arguments ........................



    Error 2 Argument '1': cannot convert from 'string' to 'System.DateTime' ...............................


    Error 3 Argument '2': cannot convert from 'System.DateTime' to 'string'


    any one can help me

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2007
    Posts
    270

    Re: Problem in inserting data using Silverlight

    i added following lines of code too

    Code:
      private void   InsertVoteCompleted(Object sender,  System.ComponentModel.AsyncCompletedEventArgs e)
        {
          // lblMsg.Text = "Added Successfully!" ;
    
        }
    but did not find the solution uptill now

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