Guest User

Untitled

a guest
Jul 12th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.17 KB | None | 0 0
  1. Imports ADOX
  2. Imports System.Data.OleDb
  3.  
  4. Public Class Form1
  5.  
  6.     Private Sub Button1_Click() Handles Button1.Click
  7.         'Create accdb file
  8.         Dim cat As New Catalog()
  9.         Try
  10.             cat.Create("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\cory\Bluepoint Design\Clients\Tejas Tax Lending\Tasks\1061\NewDB7.accdb")
  11.         Catch Excep As System.Runtime.InteropServices.COMException
  12.             MessageBox.Show(Excep.Message & vbCrLf & vbCrLf & "Exiting subroutine now", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
  13.         Finally
  14.             cat = Nothing
  15.         End Try
  16.         'Create table
  17.         '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")
  18.         'con.Open()
  19.         'Dim cmd As New OleDb.OleDbCommand("CREATE TABLE Test1([Field1] TEXT(10), [Field2] TEXT(10))", con)
  20.         'cmd.ExecuteNonQuery()
  21.         'Insert a record
  22.         'cmd = New OleDb.OleDbCommand("INSERT INTO Test1(Field1, Field2) VALUES('data1', 'data2')", con)
  23.         'cmd.ExecuteNonQuery()
  24.         'con.Close()
  25.     End Sub
  26.  
  27. End Class
Add Comment
Please, Sign In to add comment