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();
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;

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

7 Years
Discussion Span
Last Post by abelLazm

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


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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.