D
dibusi
i have a trouble with datagrid with web matrix.It doesn't browse the records
when i click on the navigation buttons of the datagrid.it displays only the
first records.
thankyou for the help.
Sub Page_Load(Sender As Object, E As EventArgs)
If Not Page.IsPostBack Then
' Databind the data grid on the first request only
' (on postback, rebind only in paging command)
DATAGRID1.VirtualItemCount=2000
BindGrid()
End If
End Sub
Sub DataGrid_Page(Sender As Object, e As DataGridPageChangedEventArgs)
BindGrid()
DataGrid1.CurrentPageIndex = e.NewPageIndex
End Sub
sub BindGrid()
' TODO: update the ConnectionString value for your application
' DataGrid1.DatakeyField="AMAT_NUME_TIERS"
Dim ConnectionString AS String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\assmat\bdamat2000.MDB"
'Dim ConnectionString As String =
"server=(local);database=pubs;trusted_connection=true"
Dim CommandText As String = "select amat_nume_tiers,amat_nom_1 as nom,
AMAT_PRENOM as prénom from tamat"
DIM commande AS STRING
dim valeur as String=request.querystring("nom")
IF valeur<>"" then
commande =" where amat_nom_commune like '" & valeur & "%'"
end if
CommandText=CommandText & commande & " order by amat_nom_1"
Dim myConnection As New OleDbConnection
myConnection.ConnectionString=ConnectionString
myConnection.Open()
Dim myCommand As New OleDbCommand(CommandText, myConnection)
DataGrid1.DataSource =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
DataGrid1.DataBind()
End Sub
when i click on the navigation buttons of the datagrid.it displays only the
first records.
thankyou for the help.
Sub Page_Load(Sender As Object, E As EventArgs)
If Not Page.IsPostBack Then
' Databind the data grid on the first request only
' (on postback, rebind only in paging command)
DATAGRID1.VirtualItemCount=2000
BindGrid()
End If
End Sub
Sub DataGrid_Page(Sender As Object, e As DataGridPageChangedEventArgs)
BindGrid()
DataGrid1.CurrentPageIndex = e.NewPageIndex
End Sub
sub BindGrid()
' TODO: update the ConnectionString value for your application
' DataGrid1.DatakeyField="AMAT_NUME_TIERS"
Dim ConnectionString AS String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\assmat\bdamat2000.MDB"
'Dim ConnectionString As String =
"server=(local);database=pubs;trusted_connection=true"
Dim CommandText As String = "select amat_nume_tiers,amat_nom_1 as nom,
AMAT_PRENOM as prénom from tamat"
DIM commande AS STRING
dim valeur as String=request.querystring("nom")
IF valeur<>"" then
commande =" where amat_nom_commune like '" & valeur & "%'"
end if
CommandText=CommandText & commande & " order by amat_nom_1"
Dim myConnection As New OleDbConnection
myConnection.ConnectionString=ConnectionString
myConnection.Open()
Dim myCommand As New OleDbCommand(CommandText, myConnection)
DataGrid1.DataSource =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
DataGrid1.DataBind()
End Sub