Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 dataset Update

Author  Topic 

salmonraju
Yak Posting Veteran

54 Posts

Posted - 2006-11-24 : 04:51:42
i wrote a simple application which diplays two tables on a single DataGrid (by joining two tables)
//**************
sqldataAdapter cmd = new SqlDataAdapter("select b.BookId,e.EntityName,b.Author1 from EntityTable as e ,BooksEntity as b where e.EntityId = b.BookId ", con);
build = new SqlCommandBuilder(cmd);
cmd.Fill(ds);
dataGridView1.DataSource= ds.Tables[0];

now I modified data on DataGrid and click Update_Button
this buttton updates the dataset(here named ds) to database

if (ds.HasChanges())
{
cmd.Update(ds);

ds.AcceptChanges();
}

HERE COMES MY PROBLEM
ds.HasChanges is true and the control is entering into if block
when executing "cmd.Update(ds)"
i am getting an exception like this
Dynamic SQL generation is not supported against multiple base tables.

how can i avoid this exception,what is base table




SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-24 : 04:55:09
As the error says, updates are not allowed when using more than one table in the query because you join them.



Peter Larsson
Helsingborg, Sweden
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-24 : 04:58:06
Did you google? I found this article...hope it helps you:

[url]http://dotnetjini.jigneshdesai.com/dotnet-whidbey/ShowArticle.aspx?ID=2[/url]

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page
   

- Advertisement -