Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports ADOX
- Imports System.Data.OleDb
- Public Class Form1
- Private Sub Button1_Click() Handles Button1.Click
- 'Create accdb file
- Dim cat As New Catalog()
- Try
- cat.Create("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\cory\Bluepoint Design\Clients\Tejas Tax Lending\Tasks\1061\NewDB7.accdb")
- Catch Excep As System.Runtime.InteropServices.COMException
- MessageBox.Show(Excep.Message & vbCrLf & vbCrLf & "Exiting subroutine now", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Finally
- cat = Nothing
- End Try
- 'Create table
- 'Dim con As New OleDb.OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;Data Source =C:\Users\cory\Bluepoint Design\Clients\Tejas Tax Lending\Tasks\1061\NewDB6.accdb")
- 'con.Open()
- 'Dim cmd As New OleDb.OleDbCommand("CREATE TABLE Test1([Field1] TEXT(10), [Field2] TEXT(10))", con)
- 'cmd.ExecuteNonQuery()
- 'Insert a record
- 'cmd = New OleDb.OleDbCommand("INSERT INTO Test1(Field1, Field2) VALUES('data1', 'data2')", con)
- 'cmd.ExecuteNonQuery()
- 'con.Close()
- End Sub
- End Class
Add Comment
Please, Sign In to add comment