Hi,
use this it will work fine.
actually u have to call binddata() in pageindexchanging event
Imports System.data
Imports System.Data.Sqlclient
Partial Class Default2
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim boom As String = Session("title")
title.Text = boom
lbtitle.Text = title.Text
binddata()
End Sub
Protected Sub gridView1_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
GridView1.PageIndex = e.NewPageIndex
binddata()
End Sub
Public Sub binddata()
Dim str As String
Dim con As SqlConnection = New SqlConnection("Data Source=ML0003135586;Initial Catalog=TestSQL;Integrated Security=True")
con.Open()
str = "Select [addon],[username] from [tblForums] where ([title]=@title)"
Dim command As SqlCommand = New SqlCommand(Str, con)
command.Parameters.AddWithValue("@title", title.Text)
GridView1.DataSource = command.ExecuteReader
GridView1.DataBind()
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
wew()
End Sub
Public Sub wew()
Dim str As String
Dim con As SqlConnection = New SqlConnection("Data Source=ML0003135586;Initial Catalog=TestSQL;Integrated Security=True")
con.Open()
str = "INSERT INTO [tblForums](title, username,addon) VALUES (@title, @username, @addon)"
Dim command As SqlCommand = New SqlCommand(str, con)
command.Parameters.Add("@title", SqlDbType.NVarChar).Value = lbtitle.Text
command.Parameters.Add("@username", SqlDbType.NChar).Value = tbname.Text
command.Parameters.Add("@addon", SqlDbType.NVarChar).Value = text.Text
command.ExecuteNonQuery()
End Sub.