sornram9254

ASP.NET (VB.NET) - SQLite

Apr 11th, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.06 KB | None | 0 0
  1. Public Class _Default
  2.     Inherits System.Web.UI.Page
  3.  
  4.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  5.  
  6.     End Sub
  7.  
  8.     Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  9.         Dim ds As DataSet = New DataSet
  10.         Dim connection As New SQLite.SQLiteConnection("Data Source=7-11_TawaDB")
  11.         Dim adapter As New SQLite.SQLiteDataAdapter("SELECT * FROM exam_branch", connection)
  12.         connection.Open()
  13.         adapter.Fill(ds, "exam_branch")
  14.         For i As Integer = 0 To adapter.Fill(ds) - 1
  15.     'adapter.Fill(ds) => จำนวนข้อมูลที่มี เช่นตัวอย่างที่อยู่ในฐานข้อมูล มีสาขา 7-11 อยู่ 34 สาขา สรุปก็คืออันนี้วนลูปตั้งแต่ 0 ถึง 34 - 1
  16.             TextBox1.Text += ds.Tables("exam_branch").Rows(i).Item("name_branch") + Environment.NewLine
  17.         Next
  18.         connection.Close()
  19.     End Sub
  20. End Class
Advertisement
Add Comment
Please, Sign In to add comment