MS Access
Imports [Link]
Dim con As New OdbcConnection("DSN=yoh;")
Dim cmd As New OdbcCommand
Public neym As String
Public Sub New()
[Link]()
[Link] = con
[Link] = "SELECT * FROM table1"
End Sub
Public Sub creates()
[Link] = "INSERT INTO table1(Neyms) VALUES('" + neym + "')"
[Link]()
End Sub
Imports [Link]
Dim con As New
OledbConnection("Provider=[Link].4.0DataSource=D:\[Link];")
Dim cmd As New OledbCommand
Public var1 As String
Public Sub New()
[Link]()
[Link] = con
[Link] = "SELECT * FROM table1"
End Sub
Public Sub creates()
[Link] = "INSERT INTO table1(Neyms) VALUES('" + var1 + "')"
[Link]()
End Sub
Collapse | Copy Code
Grabs data from a table and posts it into a ListView
Dim Table_ As String = "Table1"
Dim query As String = "SELECT * FROM " & Table_
Dim MDBConnString_ As String = "Provider=[Link].4.0;Data
Source=[Link];"
Dim ds As New DataSet
Dim cnn As OleDbConnection = New OleDbConnection(MDBConnString_)
[Link]()
Dim cmd As New OleDbCommand(query, cnn)
Dim da As New OleDbDataAdapter(cmd)
[Link](ds, Table_)
[Link]()
Dim t1 As DataTable = [Link](Table_)
Dim row As DataRow
Dim Item(2) As String
For Each row In [Link]
Item(0) = row(0)
Item(1) = row(1)
Dim NextListItem As New ListViewItem(Item)
[Link](NextListItem)
Next
Dim sDBPassword as String
Dim oDBEngine As [Link]
Dim oDB As [Link]
sDBPassword = "Mypassword" 'database password
oDBEngine = [Link]
oDB = [Link](Name:=sDBPath, _
Options:=False, _
ReadOnly:=False, _
Connect:=";PWD=" & sDBPassword)
[Link](filepath:=sDBPath, _
Exclusive:=False)
[Link]()
[Link](oDB)
oDB = Nothing
[Link](oDBEngine)
oDBEngine = Nothing