|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Sunday, March 26, 2006Populating myDataSet and Binding a ListControl Example (Chapter 3)
1. Sub bindListControl()
2. Dim myConn As OleDbConnection 3. Dim myOleDbAdapter As OleDbDataAdapter 4. Dim connStr, sqlStr As String 5. Dim myDataSet As New Dataset 6. connStr="Provider=Microsoft.Jet.OLEDB.4.0;" _ 7. + "Data Source=D:\Products.mdb" 8. sqlStr="SELECT ProductId, ProductName, Price, ImagePath " _ 9. + "FROM Products WHERE Price>45.00 ORDER BY Price" 10. myConn= New OleDbConnection(connStr) 11. myConn.Open() 12. myOleDbAdapter =New OleDbDataAdapter(sqlStr,myConn) 13. myOleDbAdapter.Fill(myDataSet,"dtProducts") 14. repeater1.DataSource=myDataSet.Tables("dtProducts") 15. repeater1.DataBind() 16. End Sub to do the following examples, you must create Products.mdb in your hard drive. |
0 Comments:
Post a Comment
<< Home