TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
gaurav kaushik
NA
49
0
how to update row in grid view.
Aug 12 2008 2:05 AM
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating nm = CType(GridView1.Rows(e.RowIndex).Cells(2).Controls(0), TextBox).Text sal = Convert.ToDouble(CType(GridView1.Rows(e.RowIndex).Cells(3).Controls(0), TextBox).Text) conn.Open() cmd = New SqlCommand cmd.CommandText = "update emptb set name=@e2,salary=@e3 where code=@e1" cmd.Parameters.Add("@e1", SqlDbType.Int).Value = GridView1.DataKeys(e.RowIndex).Value(0) cmd.Parameters.Add("@e2", SqlDbType.NVarChar).Value = nm cmd.Parameters.Add("@e3", SqlDbType.Money).Value = sal cmd.Connection = conn cmd.ExecuteNonQuery() cmd.Dispose() conn.Close() GridView1.EditIndex = -1 bind() Public Sub bind() adp = New SqlDataAdapter("select * from emptb", str) ds = New DataSet adp.Fill(ds) GridView1.DataSource = ds GridView1.DataBind() ds.Clear() adp.Dispose() End Sub html code is:
i used emptb=table with three fields code,name, salary please tell me solution as soon as posible.
Reply
Answers (
2
)
how to pass parameters using mysqlcommand if i am passing like this i.m getting error can any one help me plssssssssssssss
Error while installing the AJAXControl Toolkit