Im 223 - Linq Lab-Updated
Im 223 - Linq Lab-Updated
1. Create a database in SQL Server 2008. Name it “SRIS”. Then, create a table based
on the USER interface below. Save your table as “tblStudent”.
2. Design your application using the interface below. You may enhance the design
interface but observer proper naming convention.
5. Then, start coding the application using the following code requirements (70
points)
5.1 studentcodes class
Imports System
Imports System.Data.Linq
Imports System.IO
Imports SRIS.SRISDataContext
End Sub
Public Shared Sub Delete(ByVal strCTRL As String)
If register_student.dtgStudent.Rows.Count <> 0 Then
Dim deletedStudents = (From studentrecords In dbcon.GetTable(Of tblStudent)() _
Where studentrecords.StudNo = strCTRL Select
studentrecords).SingleOrDefault
dbcon.GetTable(Of tblStudent)().DeleteOnSubmit(deletedStudents)
Try
dbcon.SubmitChanges()
MessageBox.Show("Student named: " & register_student.txtName.Text & " was
successfully deleted", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
studentcodes.LoadStudents(dtgStudent:=register_student.dtgStudent)
studentcodes.ShowFirstRecord()
Catch ex As Exception
End Try
Else
MsgBox("No Records can be deleted!")
End If
Republic of the Philippines
SULTAN KUDARAT STATE UNIVERSITY
IT Department
Kalamansig, Sultan Kudarat
End Sub
register_student(FORM CODES)
1. Declaration within the class
Public toggleswitch As Boolean ‘ for save command
16. Code for saving image (note this code is a sub procedure/function)
Sub saveimage()
Dim saveFileDialog1 As New SaveFileDialog()
saveFileDialog1.Filter = "Jpeg Image|*.jpg|Bitmap Image|*.bmp|Gif
Image|*.gif"
saveFileDialog1.FileName = Application.StartupPath & "\Image\" & txtstudID.Text &
".jpg"
1. Project Explorer
Best of Luck!