0

Hi,i got this error.
Error is:
The updated data was repeated again.when i refresh the page,it comes correctly,
How i rectify it
codings given below
---------------------------
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
' GridView1.AutoGenerateColumns = False

Dim row As GridViewRow
Dim Exp As TextBox
Dim Amount As TextBox
row = GridView1.Rows(e.RowIndex)
Exp = row.FindControl("Textbox1")
Amount = row.FindControl("Textbox2")
conn.Open()
mycomm.CommandText = "update get set Amount='" & Amount.Text & "' where Expenses= '" & Exp.Text & "'"
mycomm.ExecuteNonQuery()
conn.Close()
GridView1.EditIndex = -1

bind()

End Sub

---------------------

Sub bind()

myadapter = New SqlDataAdapter("select * from get where datename(Month,Currentdate)='" & DropDownList1.SelectedItem.Text & "'", conn)

myadapter.Fill(myset, "get")

GridView1.DataSource = myset.Tables(0)

GridView1.DataBind()

End Sub
---------------------

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by dnanetwork
0

myset = New DataSet
conn = New SqlConnection()
conn.ConnectionString = "initial catalog=home;user id=sa;pwd=''"
conn.Open()
mycomm = New SqlCommand()
mycomm.Connection = conn
conn.Close()

0

This is the code written in page_load.
myset = New DataSet
conn = New SqlConnection()
conn.ConnectionString = "initial catalog=home;user id=sa;pwd=''"
conn.Open()
mycomm = New SqlCommand()
mycomm.Connection = conn
conn.Close()

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.