<%@ Page Language="VB" AutoEventWireup="True" Debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
      
Dim MyConnection as OleDbConnection

      
Sub Page_Load(sender As Object, e As EventArgs) 
          MyConnection 
= New OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0; Data Source =" + Server.MapPath(".")+"/db/otherdata.mdb")

         
If Not IsPostBack Then 
            BindGrid()
         
End If
      
End Sub


      
Sub MyDataGrid_Page(sender as Object, e As DataGridPageChangedEventArgs) 
         MyDataGrid.CurrentPageIndex 
= e.NewPageIndex
         BindGrid()
      
End Sub


      
Sub BindGrid() 
          
Dim MyCommand As OleDbDataAdapter = new OleDbDataAdapter("Select * FROM info", MyConnection)
          
Dim DS As DataSet = new DataSet()
          MyCommand.Fill(DS,
"info"
          MyDataGrid.DataSource 
= DS.Tables("info").DefaultView
          MyDataGrid.DataBind()
      
End Sub


Protected Sub DataGrid_ItemDataBound(ByVal sender As ObjectByVal e As DataGridItemEventArgs) 
          
If e.Item.ItemType = ListItemType.AlternatingItem OrElse e.Item.ItemType = ListItemType.Item Then 
            
If Not (e.Item.Cells(2).Text = "&nbsp;"Then 
               
If Convert.ToDouble(e.Item.Cells(2).Text) > Convert.ToDouble(100000Then 
                  e.Item.BackColor 
= System.Drawing.Color.LightBlue 
                  e.Item.ForeColor 
= System.Drawing.Color.SandyBrown 
               
End If 
               e.Item.Cells(
2).Text = String.Format("{0:c}", Convert.ToDouble(e.Item.Cells(2).Text)) 
            
Else    
               e.Item.Cells(
2).Text = String.Format("{0}""No Sales"
               e.Item.Cells(
2).ForeColor = System.Drawing.Color.red
            
End If 
          
End If 
End Sub

</script>

<FORM id="Form1" method="post" runat="server">
      
<ASP:DATAGRID id="MyDataGrid" 
                    width
="200" 
                    runat
="server" 
                    autogeneratecolumns
="False" 
                    showfooter
="False"
                    BACKCOLOR="#E0E0E0"
                    OnItemDataBound="DataGrid_ItemDataBound">
        
<ALTERNATINGITEMSTYLE BACKCOLOR="Silver"></ALTERNATINGITEMSTYLE>
        
<HEADERSTYLE FONT-BOLD="True" FORECOLOR="White" BACKCOLOR="Black"></HEADERSTYLE>
        
<COLUMNS>
          
<asp:BoundColumn DataField="ProductID" HeaderText="Product ID">
            
<ITEMSTYLE HORIZONTALALIGN="Left"></ITEMSTYLE>
          
</asp:BoundColumn>
          
<asp:BoundColumn DataField="ProductName" HeaderText="Product Name">
            
<ITEMSTYLE HORIZONTALALIGN="Left"></ITEMSTYLE>
          
</asp:BoundColumn>
          
<asp:BoundColumn DataField="CategoryName" HeaderText="Category ">
            
<ITEMSTYLE HORIZONTALALIGN="Right"></ITEMSTYLE>
          
</asp:BoundColumn>
        
</COLUMNS>
      
</ASP:DATAGRID>
</FORM>