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
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