Skip to content

Commit ba2ebde

Browse files
Updated
1 parent 3d13885 commit ba2ebde

File tree

2 files changed

+4
-5
lines changed
  • Binding SQLite using CustomAdaptor/Grid_SQLite/Grid_SQLite.Server/Controllers
  • Binding SQLite using UrlAdaptor/Grid_SQLite/Grid_SQLite.Server/Controllers

2 files changed

+4
-5
lines changed

Binding SQLite using CustomAdaptor/Grid_SQLite/Grid_SQLite.Server/Controllers/GridController.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ public void Update([FromBody] CRUDModel<Orders> value)
187187
[Route("api/[controller]/Remove")]
188188
public void Remove([FromBody] CRUDModel<Orders> value)
189189
{
190-
//Create query to update the changes into the database by accessing its properties.
191-
string queryStr = $"Update Orders set CustomerID='{value.value.CustomerID}', Freight='{value.value.Freight}',EmployeeID='{value.value.EmployeeID}',ShipCity='{value.value.ShipCity}' where OrderID='{value.value.OrderID}'";
190+
//Create query to remove the specific from database by passing the primary key column value.
191+
string queryStr = $"Delete from Orders where OrderID={value.key}";
192192

193193
// Establishes a connection to the SQLite database using the provided connection string.
194194
SqliteConnection Connection = new SqliteConnection(ConnectionString);
@@ -208,7 +208,6 @@ public void Remove([FromBody] CRUDModel<Orders> value)
208208
//Add custom logic here if needed and remove above method.
209209
}
210210

211-
212211
/// <summary>
213212
/// Batch update (Insert, Update, and Delete) a collection of data items from the data collection.
214213
/// </summary>

Binding SQLite using UrlAdaptor/Grid_SQLite/Grid_SQLite.Server/Controllers/GridController.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ public void Update([FromBody] CRUDModel<Orders> value)
187187
[Route("api/[controller]/Remove")]
188188
public void Remove([FromBody] CRUDModel<Orders> value)
189189
{
190-
//Create query to update the changes into the database by accessing its properties.
191-
string queryStr = $"Update Orders set CustomerID='{value.value.CustomerID}', Freight='{value.value.Freight}',EmployeeID='{value.value.EmployeeID}',ShipCity='{value.value.ShipCity}' where OrderID='{value.value.OrderID}'";
190+
//Create query to remove the specific from database by passing the primary key column value.
191+
string queryStr = $"Delete from Orders where OrderID={value.key}";
192192

193193
// Establishes a connection to the SQLite database using the provided connection string.
194194
SqliteConnection Connection = new SqliteConnection(ConnectionString);

0 commit comments

Comments
 (0)