Software Architecture Code for Wrapper Class

Topics: SQL, Set construction, Programming language Pages: 3 (270 words) Published: November 13, 2012
Wrapper to connect two applications with different architectures

Public con As ADODB.Connection
Public rs As ADODB.Recordset
Dim str As String

Private Sub Command1_Click()

Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = True

Set con = New ADODB.Connection
Set rs = New ADODB.Recordset
con.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=AIR" str = "insert into Staff values(" & Text1.Text & ",'" & Text2.Text & "', " & Text3.Text & "," & Text4.Text & ",'" & Text5.Text & "')" On Error GoTo Delete_Error

con.Execute (str)
MsgBox " Record added Successfully"

Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text1.SetFocus

Exit Sub
Delete_Error:
MsgBox "This record cannot be Added. Error code = " _
& Err.Number & vbCrLf & Err.Description, _
vbCritical, "Cannot Update Database"
End Sub

Private Sub Command2_Click()
Command1.Enabled = False
Command4.Enabled = False
Command6.Enabled = False

If (Adodc1.Recordset.BOF) Then

Adodc1.Recordset.MoveLast
Else
Adodc1.Recordset.MovePrevious
End If
End Sub

Private Sub Command3_Click()
Command1.Enabled = False
Command4.Enabled = False
Command6.Enabled = False

If (Adodc1.Recordset.EOF) Then
Adodc1.Recordset.MoveFirst
Else
Adodc1.Recordset.MoveNext
End If
End Sub

Private Sub Command4_Click()
Command4.Enabled = False
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
Command7.Enabled = False

Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text1.SetFocus
End Sub

Private Sub Command5_Click()
Unload Me
Form2.Show
End Sub

Private Sub Command6_Click()

Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""

Text1.SetFocus

End Sub

SQL COMMANDS:
create database AIR

create table Staff(Staff_id int PRIMARY KEY NOT NULL,Staff_name...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Essay on software
  • Software Architecture Essay
  • Software design and architecture Research Paper
  • Software System Architecture Essay
  • Essay about Autonomous Vehicles and Software Architectures
  • Architecture Essay
  • Software Architecture Design Patterns Essay
  • Essay on architecture

Become a StudyMode Member

Sign Up - It's Free