Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspdotnet_website_programming thread: Using OleDbCommand and OleDbAdapter


Message #1 by Shaho Toofani <shaho59@y...> on Wed, 28 Aug 2002 00:24:04 -0700 (PDT)
Hey guys

I have below snipt

Sub bindDataGrid
   Dim myConn As OleDbConnection
   Dim myOleDbAdapter As OleDbDataAdapter
   Dim myOleDbCommand As OleDbCommand
   Dim connStr, sqlStr As String
   Dim myDataSet As New Dataset
   Dim intCat As Integer

 intCat=Int32.Parse(Request.QueryString("id"))

   connStr="Provider=Microsoft.Jet.OLEDB.4.0; " _
                + "Data Source=D:\inetpub\wwwroot\temp\me2\db\db.mdb"
   
   sqlStr = "SELECT  article_title, article_author, cat_caption " _
              +   " FROM Articles Where article_category=@article_category"
   myConn= New OleDbConnection(connStr)
   myConn.Open()
   myOleDbCommand=New OleDbCommand(sqlStr,myConn)
   myOleDbAdapter.SelectCommand=myOleDbCommand
   myOleDbCommand.Parameters.Add("@article_category", intCat)
   myOleDbAdapter.Fill(myDataSet)
   dataGrid1.DataSource = myDataSet
   dataGrid1.DataBind()
   myConn.Close()
 End Sub
 Sub doPaging(s As Object, e As DataGridPageChangedEventArgs)
     dataGrid1.CurrentPageIndex = e.NewPageIndex
     bindDataGrid
  End Sub


when i run it the browser give me error , however it is just a copy of .net framework SDK,



---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes

  Return to Index