Sumit Kumawat

Sumit Kumawat

  • NA
  • 454
  • 405.3k

How to Display Message on client project which comes from WCF?

Apr 12 2012 6:08 AM
Hi all,
i am writing Data Base Connectivity method in WCF in which i am cheacking if data exist then It should check that data in in Database or not else insert data in Database.
now if there is already Data inside the data base how can i send msg to client that data is already there.
here is my Wcf code...

 public void Insert(string value, string value1, string value2)
{

       string select = "Select count(*) from Test where FName = '" + value1 + "' ";
            SqLite_con = new SQLiteConnection(@"data source=E:\WCF.s3db;Version=3;New=False;Compress=True;");
            SqLite_con.Open();
            Sqlite_cmd = new SQLiteCommand(select, SqLite_con);
            int count = Convert.ToInt32(Sqlite_cmd.ExecuteScalar());
            SqLite_con.Close();
            if (count > 0)
            {
                        /// here if data is exist i want to send msg
            }
            else
            {

                string Insert = "Insert into RackSpaceDownload (FName,Source_path,Destination_path,Last_modified_date) values ('" + value1 + "','" + SourcePath + "','" + value2 + "','" + FileDate + "')";
                SqLite_con = new SQLiteConnection(@"data source=E:\WCF.s3db;Version=3;New=False;Compress=True;");
                SqLite_con.Open();
                Sqlite_cmd = SqLite_con.CreateCommand();
                Sqlite_cmd.CommandText = Insert;
                Sqlite_cmd.ExecuteNonQuery();
                SqLite_con.Close();
 
            }
}


Answers (2)