Hi! I used below code but not update table. I want used gridview update.
protected void Grid_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string nm = ((TextBox)Grid.Rows[e.RowIndex].FindControl("TextBox1")).Text;
string pr = ((TextBox)Grid.Rows[e.RowIndex].FindControl("TextBox2")).Text;
string kod = ((TextBox)Grid.Rows[e.RowIndex].FindControl("TextBox3")).Text;
Grid.EditIndex = -1;
//service.Tool_chengeil(nm, pr, kod);
SqlConnection con = new SqlConnection(UserData);
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = "update underspb set idb = idb, nameb = N'" + nm + "', price ='" + pr + "' where id ='" + kod + "'";
con.Open();
try
{
cmd.ExecuteReader();
}
catch { };
con.Close();
}
When I used stored procedure it’s worked without problem. But I want use it’s in under grid view update because I have Unicode characters must used N prefix. In bellow I show sql table.
Id
|
Idb
|
Nameb
|
Price
|
1
|
1
|
Таҳлили пешоб тибқи Амбурже
|
4
|
2
|
1
|
Самти глюкозурӣ
|
4
|
3
|
1
|
Тадқиқи моеи ҳароммағз
|
8
|
4
|
1
|
Муайян намудани сафеда дар пешоб тибқи Бейн-Ҷонс
|
10
|
5
|
1
|
Таҳлили фазла барои тухми гиҷҷа бо усули Като
|
9
|
Stored procedure:
CREATE PROCEDURE UPDIL
@ID INT,
@NAME NVARCHAR(200),
@PRICE FLOAT
WITH ENCRYPTION
AS
UPDATE UNDERSPB
SET IDB = IDB,
NAMEB = @NAME,
PRICE = @PRICE
WHERE ID = @ID