in my asp.net+vb web with access database. i have gridview. i had added a form with submit button to add the data in gridview.
i am using accessdatasource to bind the data to gridview.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim connectString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\web\auth.mdb"
Dim con As OleDbConnection = New OleDbConnection(connectString)
con.Open()Dim sql_ins As String
sql_ins = "insert into tasks (Appt,Task,Actionby,Complete,Remark) values (@a,@b,@c,@d,@e)"
Dim oledbcom As New OleDbCommand(sql_ins, con)
oledbcom.Parameters.Add(New OleDbParameter("@a", OleDbType.VarChar, 8)).Value = DropDownList1.Text
oledbcom.Parameters.Add(New OleDbParameter("@b", OleDbType.VarChar, 50)).Value = tasktxt.Text
oledbcom.Parameters.Add(New OleDbParameter("@c", OleDbType.VarChar, 50)).Value = DropDownList2.Text
oledbcom.Parameters.Add(New OleDbParameter("@d", OleDbType.Date)).Value = comptxt.Text
oledbcom.Parameters.Add(New OleDbParameter("@e", OleDbType.VarChar, 50)).Value = rmk.Text
oledbcom.ExecuteNonQuery()
GridView1.DataBind()
tasktxt.Text = ""
comptxt.Text = ""
DropDownList1.Text = "Select"
DropDownList2.Text = "Select"
Page.ClientScript.RegisterStartupScript(Me.GetType, "Forms", "<script> alert('Record Inserted Succesfully .........') </script>")
End Sub
even after the data inserted message flshes the data inserted is not viewed in the gridview . when i press F% or refresh tha page the gets displayed in gridview. how can i solve the problem