Hi guys, I have a grid view populated with data and at the bottom there is a Add template button so that when user clicks on it, a new row will be populated below and user not only able to view the previous data but there can also add in new records at the same time. How do I populate a new row at the bottom?
Next, how do i make use of the method defined in stored procedure and database.cs to insert new records to database. This is the database.cs:
public bool Insert_ItemRecords(string itemID, string itemName, string
itemDesc)
{
SqlCommand cmd_ItemList = new SqlCommand();
cmd_ItemList.CommandText =
"[VRM].[INSERT_ItemRecords]";
cmd_ItemList.CommandType =
CommandType.StoredProcedure;
cmd_ItemList.Parameters.Clear();
SqlParameter sqlParaItemID = new SqlParameter("@itemID", SqlDbType.VarChar,
10);
sqlParaItemID.Value =
itemID;
cmd_ItemList.Parameters.Add(sqlParaItemID);
SqlParameter sqlParaItemName = new SqlParameter("@itemName", SqlDbType.VarChar,
100);
sqlParaItemName.Value =
itemName;
cmd_ItemList.Parameters.Add(sqlParaItemName);
SqlParameter sqlParaItemDesc = new SqlParameter("@itemDesc", SqlDbType.VarChar,
1000);
sqlParaItemDesc.Value =
fileName;
cmd_ItemList.Parameters.Add(sqlParaItemDesc);
return
executeNotQuery(cmd_ItemList);
}
|
This is the stored procedure:
ALTER PROCEDURE [OS].[INSERT_ITEMRecords] @itemID
varchar(10), @itemName varchar(100), @itemDesc varchar(1000)
AS INSERT INTO OS.Items (itemID, itemName, itemDesc) VALUES
(@itemID, @itemName, @itemDesc)
|
How do i do the business logic? Can you guys give me some hints? Thanks