C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Reading Xml File into dataset, editing it and inserting it into DataBase - Regarding


Posted Date: 10 Sep 2006      Total Responses: 1

Posted By: vishal sharma       Member Level: Gold     Points: 2


hi dear

i am reading a xml file into dataset as (in web app. using c#) :

DataSet ds=new DataSet("Class");
ds.ReadXml(Server.MapPath("test.xml"));

i added a new record in xml file as:

DataRow DTRow=ds.Tables[0].NewRow();
DTRow[0]="Value1";
DTRow[1]="Value1";
DTRow[2]="Value1";
ds.Tables[0].Rows.Add(DTRow);

now what i need here is to insert this dataset records in database table.

and i want this with the sqldataadapter and sqlcommandbuilder class.....

i am doing this way :

SqlDataAdapter sda=new SqlDataAdapter();
sda.SelectCommand=new SqlCommand("select * from student",Conn);
sda.TableMappings.Add("student","ds.Tables[0]");
sqlCommandBuilder objCMD=new SqlCommandBuilder(sda);
objCMD.GetInsertCommand();
sda.Update(ds); -------------------------- *

but it is throwing an exception at line marked as '*' above ('sda.update') which is

System.InvalidOperationException:
Update unable to find TableMapping['Table'] or DataTable 'Table'.


guys please help in the matter............................

regards
vishal sharma




Responses

Author: Rajaraman    10 Sep 2006Member Level: DiamondRating:     Points: 2
hi
find some samples are in this site.

http://www.dbazine.com/sql/sql-articles/cook2

http://www.codeproject.com/useritems/XMLData.asp

Regards,


Post Reply
You must Sign In to post a response.
Next : Javascript validation
Previous : deploying applications of asp.net 2005 in which crystal report is used
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

it support

Contact Us    Privacy Policy    Terms Of Use