|
-
Sep 24th, 2003, 09:20 AM
#1
Thread Starter
Member
Update data Using DataGrid and Data adapter
Hi,
I am using the Dataset, DataAdapter,CommandBuilder and DataGrid in order to show and update data from a table called: "DiseaseTab".
The data is shown in the datagrid but the updated data (which the user did from the datagrid) would not update my SQL server table. I do not understand why.
I am keep getting the following Error:
"Dynamic SQL generation is not supported against multiple base tables."
My code is: (cn is my connection to SQL Server)
------------------------------------------------------------
Form_Load(...) Event
------------------------
Dim DA As SqlClient.SqlDataAdapter
DA = New SqlClient.SqlDataAdapter("select ...",cn)
DA.TableMappings.Add("Table", "DiseaseTab")
ds1 = New DataSet
DA.Fill(ds1)
DataGrid1.DataSource = ds1.Tables("DiseaseTab")
UpdateButton_Click Event...
------------------------------------
Dim DA As SqlClient.SqlDataAdapter
Dim ComandBuilder As SqlClient.SqlCommandBuilder
DA = New SqlClient.SqlDataAdapter("select diagnosis ,description ,recinsertdate,cntbefore ,delta ,deltainpercents ,FileFrom ,CanBeInserted from view_BeforeUploadAddNewWithSRCDesc where RecInsertDate in (Select RecInsertDate from tblAddnewToDiseaseTab where DiseaseUpdated<>'True') ", rpt.cn)
DA.TableMappings.Add("Table", "DiseaseTab")
ComandBuilder = New SqlClient.SqlCommandBuilder(DA)
DA.Update(ds1, "DiseaseTab")
'THE LAST SENTENCE BRINGS UP THE ERROR MSGBOX...
Last edited by nimrod_rotner; Sep 24th, 2003 at 09:30 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|