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

this code giving me the error like "Multiple Base table " Some thing like that

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.