problem updating datagrid
-
having performed an update in a datagrid, i get this message box: " insufficient key column information for updating or refreshing" (even though the table in the database updates successfully), why is this? Thanking you!
mcm wrote: having performed an update in a datagrid, i get this message box: " insufficient key column information for updating or refreshing" (even though the table in the database updates successfully) There could be a number of reasons for your problem. One of the most common reasons is that your data was retrieved from multiple tables. The other tables would like to try updating, but they can't because the primary key is not available in the retrieved data. If you could provide more specifics, you might get a more useful response. For example, what kind of data are you retrieving (Access, SQL, Oracle)? Are you using ADO, ODBC, or something else to get the data? We need enough information to "debug" the problem.
-
mcm wrote: having performed an update in a datagrid, i get this message box: " insufficient key column information for updating or refreshing" (even though the table in the database updates successfully) There could be a number of reasons for your problem. One of the most common reasons is that your data was retrieved from multiple tables. The other tables would like to try updating, but they can't because the primary key is not available in the retrieved data. If you could provide more specifics, you might get a more useful response. For example, what kind of data are you retrieving (Access, SQL, Oracle)? Are you using ADO, ODBC, or something else to get the data? We need enough information to "debug" the problem.
im so sorry for my lack of information - the following is code relating to populating the datagrid: Dim strType As String strType = DataComboType.Text Dim strDesc As String strDesc = DataComboDesc.Text 'selecting the appropriate values Dim findSQL As String findSQL = "SELECT Price.ProductCode, Product.Description, Price.Price " & _ " FROM ProductType INNER JOIN (Product INNER JOIN (PriceDescription INNER JOIN Price ON PriceDescription.PriceCode = Price.PriceCode) ON Product.Code = Price.ProductCode) ON ProductType.TypeCode = Product.TypeCode " & _ " WHERE (((PriceDescription.PriceDesc) = '" & strDesc & "') AND ((ProductType.Description)='" & strType & "'))" Set RS = Conn.Execute(findSQL) 'refreshing the grid Adodc3.RecordSource = findSQL DataGrid1.Visible = True Set DataGrid1.DataSource = Adodc3 Adodc3.Refresh 'DataGrid1.Refresh cmdSave.Enabled = True i wish to edit details in the grid once populated but it returns that error when i make any changes in the grid - its access im using in the backend. if you require anymore information, let me know - thank you so much for your time!
-
im so sorry for my lack of information - the following is code relating to populating the datagrid: Dim strType As String strType = DataComboType.Text Dim strDesc As String strDesc = DataComboDesc.Text 'selecting the appropriate values Dim findSQL As String findSQL = "SELECT Price.ProductCode, Product.Description, Price.Price " & _ " FROM ProductType INNER JOIN (Product INNER JOIN (PriceDescription INNER JOIN Price ON PriceDescription.PriceCode = Price.PriceCode) ON Product.Code = Price.ProductCode) ON ProductType.TypeCode = Product.TypeCode " & _ " WHERE (((PriceDescription.PriceDesc) = '" & strDesc & "') AND ((ProductType.Description)='" & strType & "'))" Set RS = Conn.Execute(findSQL) 'refreshing the grid Adodc3.RecordSource = findSQL DataGrid1.Visible = True Set DataGrid1.DataSource = Adodc3 Adodc3.Refresh 'DataGrid1.Refresh cmdSave.Enabled = True i wish to edit details in the grid once populated but it returns that error when i make any changes in the grid - its access im using in the backend. if you require anymore information, let me know - thank you so much for your time!
Anonymous wrote: findSQL = "SELECT Price.ProductCode, Product.Description, Price.Price " & _ " FROM ProductType INNER JOIN (Product INNER JOIN (PriceDescription INNER JOIN Price ON PriceDescription.PriceCode = Price.PriceCode) ON Product.Code = Price.ProductCode) ON ProductType.TypeCode = Product.TypeCode " & _ " WHERE (((PriceDescription.PriceDesc) = '" & strDesc & "') AND ((ProductType.Description)='" & strType & "'))" You are selecting data from the Price and Product tables. Which colunns are being edited? To update the Description, you need the primary key of the Product table to be included in the data. To update the ProductCode or Price columns, you need the primary key of the Price table in the data. Without the primary key columns in the data, the proper row can't be located for updating.