0

Hi All
i am filling dataadapter by using query which contains joins Means Retraive data from Multiple Table and fill that data into datatable code shows as follows

_problemAdapter = new MySqlDataAdapter("SELECT xr.ID,vw.ID view_ID,  vw.DX, vw.DisplayName, xr.Active,xr.Preferred  FROM vw_Dignosis vw LEFT JOIN diagnosisXref xr  ON vw.ID=xr.View_ID ORDER BY vw.DX;", SupraClasses.SupraConnection.Instance);
cmdBldr = new MySqlCommandBuilder(_problemAdapter);
_problemListTable = new DataTable();
_problemAdapter.Fill(_problemListTable);
table = _problemListTable.Copy();

and then after assigned table to Datagrid ftera changing in datagrid i write following code to Update Adapter Method like this

_problemListTable = (DataTable)Convert.ChangeType(Results.DataSource, typeof(DataTable));
MySqlCommand Insert = new MySqlCommand("INSERT INTO diagnosisXref (view_ID,Active,Preferred) VALUES(@view_ID,@Active,@Preferred)", SupraClasses.SupraConnection.Instance);
                    Insert.Parameters.Add("@view_ID", MySqlDbType.UInt32, 8, "view_ID");
                    Insert.Parameters.Add("@Active", MySqlDbType.UInt32, 1, "Active");
                    Insert.Parameters.Add("@Preferred", MySqlDbType.UInt32, 1, "Preferred");
                    _problemAdapter.InsertCommand = Insert;
                    _problemAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                    _problemAdapter.Update(_problemListTable);

i want to function like if there is vw.ID view_ID available in DiagnosisXref table then it shold Update the table and not available then Inser New Recod into Xref table

Please Help ASAP Thak you in advance

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by abelLazm
Featured Replies
  • If you have a datasource based multiple-join tables using command builder, then things will not automatically sort out for you when you push updates back to the database. You need to do more to manage this on your own with your DataAdapter. I recommend you to check these links [URL="http://msdn.microsoft.com/data/DataAccess/adonet/default.aspx"]link1[/URL]... … Read More

0

Exact ERROR is "Dynamic SQL Generation is not supported againts multiple base tables"
Please Help As ASAP

1

If you have a datasource based multiple-join tables using command builder, then things will not automatically sort out for you when you push updates back to the database. You need to do more to manage this on your own with your DataAdapter.

I recommend you to check these links link1... link2

This question has already been answered. Start a new discussion instead.
Take the time to help us to help you. Please be thoughtful and detailed and be sure to adhere to our posting rules.