Results 1 to 2 of 2

Thread: Update data Using DataGrid and Data adapter

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2001
    Location
    Israel
    Posts
    35

    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.

  2. #2
    Addicted Member
    Join Date
    Sep 2003
    Posts
    160
    Hi
    actually I would more recommend you to make dsnless connection to your sql server and connect ado to your odbc dsn and let the communicate , there's alot feature in ado and probably you can avoid that error to happen

    Hope it helps.
    S. mohammad Najafi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width