Imports System.Data.Oledb Dim con As New OledbConnection("Provider=microsoft.Jet.oledb.4.0DataSource=D:\mydata.mdb;") Dim cmd As New OledbCommand Public var1 As String Public Sub New() con.Open() cmd.Connection = con cmd.CommandText = "SELECT * FROM table1" End Sub Public Sub creates() cmd.CommandText = "INSERT INTO table1(Neyms) VALUES('" + var1 + "')" cmd.ExecuteNonQuery() End Sub
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=Microsoft.Jet.OLEDB.4.0;Data Source=TestDatabase.mdb;" Dim ds As New DataSet Dim cnn As OleDbConnection = New OleDbConnection(MDBConnString_) cnn.Open() Dim cmd As New OleDbCommand(query, cnn) Dim da As New OleDbDataAdapter(cmd) da.Fill(ds, Table_) cnn.Close() Dim t1 As DataTable = ds.Tables(Table_) Dim row As DataRow Dim Item(2) As String For Each row In t1.Rows Item(0) = row(0) Item(1) = row(1) Dim NextListItem As New ListViewItem(Item) ListView1.Items.Add(NextListItem) Next
Dim MDBConnString_ As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\172.16.0.233\DatabaseFolder\DatabaseName.mdb;"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)