Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Data.OleDb
Imports System.Threading
Namespace WindowsApplication12
'/ <summary>
'/ Descrizione di riepilogo per Form1.
'/ </summary>
Public Class Form1
Inherits System.Windows.Forms.Form
Private WithEvents button1 As System.Windows.Forms.Button
Private WithEvents button2 As System.Windows.Forms.Button
Private lol As System.Windows.Forms.TextBox
Private asd As System.Windows.Forms.TextBox
Private label1 As System.Windows.Forms.Label
Private label2 As System.Windows.Forms.Label
'/ <summary>
'/ Variabile di progettazione necessaria.
'/ </summary>
Private components As System.ComponentModel.Container = Nothing
Public Sub New()
'
' Necessario per il supporto di Progettazione Windows Form
'
InitializeComponent()
End Sub 'New
'
' TODO: aggiungere il codice del costruttore dopo la chiamata a InitializeComponent
'
'/ <summary>
'/ Pulire le risorse in uso.
'/ </summary>
Protected Overrides Sub Dispose(disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub 'Dispose
Public Sub InserisciDati()
Dim nick As String = lol.Text
Dim nicks As String = asd.Text
Dim conn As New OleDbConnection()
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data source= " + System.Environment.CurrentDirectory + "\lol.mdb"
Try
conn.Open()
Dim sql As String = "INSERT INTO rubrica(nome,cognome) VALUES('" + nick + "','" + nicks + "');"
Dim cmd As New OleDbCommand(sql, conn)
Dim dr As OleDbDataReader = cmd.ExecuteReader()
Catch Else
Finally
conn.Close()
CreaTabella()
End Try
End Sub 'InserisciDati
Public Shared Sub CreaTabella()
Dim conn As New OleDbConnection()
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data source= " + System.Environment.CurrentDirectory + "\lol.mdb"
Try
conn.Open()
Dim sql As String = "CREATE TABLE rubrica (nome char(20),cognome char(80));"
Dim cmd As New OleDbCommand(sql, conn)
Dim dr As OleDbDataReader = cmd.ExecuteReader()
Catch Else
Finally
conn.Close()
End Try
End Sub 'CreaTabella
#Region "Codice generato da Progettazione Windows Form"
'/ <summary>
'/ Metodo necessario per il supporto della finestra di progettazione. Non modificare
'/ il contenuto del metodo con l'editor di codice.
'/ </summary>
Private Sub InitializeComponent()
Me.lol = New System.Windows.Forms.TextBox()
Me.asd = New System.Windows.Forms.TextBox()
Me.button1 = New System.Windows.Forms.Button()
Me.button2 = New System.Windows.Forms.Button()
Me.label1 = New System.Windows.Forms.Label()
Me.label2 = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
' lol
'
Me.lol.Location = New System.Drawing.Point(24, 32)
Me.lol.Name = "lol"
Me.lol.Size = New System.Drawing.Size(96, 20)
Me.lol.TabIndex = 0
Me.lol.Text = ""
'
' asd
'
Me.asd.Location = New System.Drawing.Point(168, 32)
Me.asd.Name = "asd"
Me.asd.Size = New System.Drawing.Size(104, 20)
Me.asd.TabIndex = 1
Me.asd.Text = ""
'
' button1
'
Me.button1.Location = New System.Drawing.Point(16, 72)
Me.button1.Name = "button1"
Me.button1.Size = New System.Drawing.Size(120, 48)
Me.button1.TabIndex = 2
Me.button1.Text = "CReaTaBeLLa"
'
' button2
'
Me.button2.Location = New System.Drawing.Point(160, 72)
Me.button2.Name = "button2"
Me.button2.Size = New System.Drawing.Size(120, 48)
Me.button2.TabIndex = 3
Me.button2.Text = "InSeRiSCi DaTi"
'
' label1
'
Me.label1.Location = New System.Drawing.Point(24, 8)
Me.label1.Name = "label1"
Me.label1.Size = New System.Drawing.Size(96, 16)
Me.label1.TabIndex = 4
Me.label1.Text = "NoMe"
'
' label2
'
Me.label2.Location = New System.Drawing.Point(168, 8)
Me.label2.Name = "label2"
Me.label2.Size = New System.Drawing.Size(96, 16)
Me.label2.TabIndex = 5
Me.label2.Text = "CoGnoMe"
'
' Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(296, 142)
Me.Controls.Add(label2)
Me.Controls.Add(label1)
Me.Controls.Add(button2)
Me.Controls.Add(button1)
Me.Controls.Add(asd)
Me.Controls.Add(lol)
Me.Name = "Form1"
Me.Text = "InVio DaTi Db ACCeSS By SaTaNa"
Me.ResumeLayout(False)
End Sub 'InitializeComponent
#End Region
'/ <summary>
'/ Il punto di ingresso principale dell'applicazione.
'/ </summary>
<STAThread()> _
Shared Sub Main()
Application.Run(New Form1())
End Sub 'Main
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load
End Sub 'Form1_Load
Private Sub button1_Click(sender As Object, e As System.EventArgs) Handles button1.Click
Dim f As New Thread(New ThreadStart(AddressOf CreaTabella))
f.Start()
End Sub 'button1_Click
Private Sub button2_Click(sender As Object, e As System.EventArgs) Handles button2.Click
Dim t As New Thread(New ThreadStart(AddressOf InserisciDati))
t.Start()
End Sub 'button2_Click
End Class 'Form1
End Namespace 'WindowsApplication12