Saturday, November 9, 2019
Software Architecture Code for Wrapper Class
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 varchar(20), Staff_age int, Salary int, Staff_address varchar(30)) ::Database AIR created successfully ::Table Staff creates successfully
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.