AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 how to loop through each record in a table and check if thesame record exists or not.
Posted by sandy on  1/8/2012 3:01:22 PM Category: C#
Add to my favorites
Email to friend
Hi Folks,

My webservice is returning some records and i am capturing the same in my database.Know If any one of the record changes in the webservice returned data i want to update the same in my table as well. Can you please let me know if you have any idea. Below is my sample code.

webserviceref.webservice Class PInstance = new webserviceref.webservice ();//Created an object for webservice

DataSet ds = PInstance.GetEmployees();//thewebservice class has a web method Get
Employees whichis returnted by the webservice and iam storing in a dataset

string sqlconnection = ConfigurationSettings.AppSettings["MyConnectionstring"].ToString();

foreach (DataRow dr in ds.Tables[0].Rows)
{
try
{
DatabaseCls.Parameter[] parameter = new GenericDBParameter[2];
parameter[0] = new Parameter("@Empid_ID", dr[0].ToString());
parameter[1] = new Parameter("@Emp_namee", dr[1].ToString());
DatabaseCls.ExecuteQuery.Execute(sqlconnection, "Mystoreprocedure.spInsert", parameter);
//This will insert the values in my table....

}


catch (Exception ex)
{


}


}

return "success";

}

Thanks,
SANDY

Post Your Reply Post New Question

 Viewer's Reply
This Question has 0 replies.

 
Sponsored by
When Good HTML Goes Bad: How You Can Protect Your Web Applications
Washington Technology
Integrating Silverlight 4 with SharePoint 2010 - Free 42 Page Sample Chapter