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
---------------------

show me your page_load event code..

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 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()

Try This...

it also contains the code 4 download..with sample database..
hope that helps..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.