Database Programming by Examples-Assignment Student
Database Programming by Examples-Assignment Student
Task-2
a) Tables
A table in database is a data object used to store data. Tables have the following features:
For example, a table called Address may have columns defined to store different elements of an address like, street
number, city, country, postal code, etc.
b) Fields
Fields are the columns in databases. Each field can only hold one data type at any time. e.g. a field
for a date will always, and only, hold a date. Fields can be either fixed or variable in length. They
contain a piece of specific information from a record
c) Records
A record contains all the information about a single 'member' of a table. In a students table, each
student's details (name, date of birth, contact details, and so on) will be contained in its own
record.
d) Index
Index is a summary table which lets you quickly lookup the contents of any record in a table. Think
of how you use an index to a book: as a quick jumping off point to finding full information about a
subject. A database index works in a similar way. You can create an index on any field in a table.
Example, you have a customer table which contains customer numbers, names, addresses and
other details. You can make indexes based on any information, such as the customers' customer
number, last name + first name (a composite index based on more than one field), or postal code.
Then, when you're searching for a particular customer or group of customers, you can use the
index to speed up the search. This increase in performance may not be noticeable in a table
containing a hundred records; in a database of thousands of records it will be a blessing.
e) Query
A query is an inquiry into the database using the SELECT statement. A query is used to extract
data from the database in a readable format according to the user's request. For instance, if you
have an employee table, you might issue a SQL statement that returns the employee who is paid the
most. This request to the database for usable employee information is a typical query that can be
performed in a relational database.
f) Record set
Recordset is a data structure that consists of a group of database records, and can either come
from a base table or as the result of a query to the table.
The concept is common to a number of platforms, notably Microsoft's Data Access Objects (DAO)
and ActiveX Data Objects (ADO). The Recordset object contains a Fields collection and a
Properties collection. At any time, the Recordset object refers to only a single record within the set
as the current record.
The database part of .NET, called ADO.NET, offers significant improvements in interoperability,
ease of programming and maintenance, and performance. It is an evolutionary advance from
Microsoft's earlier database technology, called simply ADO (for ActiveX Data Objects).
1) Create a connection string that contains all the needed information, such as the data
source, used name, and password. For example:
Module Module1
Public conn As New SqlClient.SqlConnection
Public Sub connect()
conn.ConnectionString = "initial catalog=sms;data source=mhasan;user id=sa;password=sa;"
End Sub
End Module
The line “Public conn As New SqlClient.SqlConnection” means create a new SQLserver connection.
Data source is the name of the computer or server where the SQLServer is installed.
Connections
There are two ADO.NET classes to create a connection to a database. The SqlConnection class is
used for connections to Microsoft SQL Server databases (version 7 and later), and the
OleDbConnection class is used for connections to databases that support the OLE DB technology
(for example, Access, Oracle, SQL Server versions 6.5 and earlier, and third party SQL products).
3) Design and implement a simple lottery Automation system with start button, stop button and
label box. While the start button is pressed the mobile numbers stored in the table should be
displayed in the label boxes and should change within a time span of 1 sec. On pressing the stop
button, the winner name and address should be displayed to the user?
Click event of
“start” button
Me.Width = 356
Timer1.Start()
GroupBox2.Visible = False
Me.Width = 356
Timertick event
Click event of “stop” button
connect()
conn.Open() Timer1.Stop()
comm.CommandText = "select * from lottery" GroupBox2.Visible = True
comm.CommandType = CommandType.Text Me.Width = 690
comm.Connection = conn Label4.Text = dt.Rows(i - 1).Item(1)
adp.SelectCommand = comm Label5.Text = dt.Rows(i - 1).Item(2)
adp.Fill(dt)
Label1.Text = dt.Rows(i).Item(0)
i=i+1
conn.Close()
4) Create a Visual Basic.NET Application for the given scenario. The database name IBS and the
table name as courses and the fields as course ID, course Name, Duration and affiliations. While
executing the application the records in the field course ID should be loaded to the combo boxes
and on selecting a particular course id, the corresponding values like course Name, Duration and
affiliations for that course should be displayed in the corresponding Text boxes.
TextBox1.Enabled = False
TextBox2.Enabled = False
TextBox3.Enabled = False
dt.Clear()
connect()
conn.Open()
comm.CommandText = "select course_id from
courses"
comm.CommandType = CommandType.Text
Declarations for the program comm.Connection = conn
adp.SelectCommand = comm
Public Class Form1 adp.Fill(dt)
Dim adp As New SqlClient.SqlDataAdapter Dim i As Integer
Dim dt, dt2 As New DataTable For i = 0 To dt.Rows.Count - 1
Dim comm As New SqlClient.SqlCommand ComboBox1.Items.Add(dt.Rows(i).Item(0))
End class Next
conn.Close()
Module Module1
Public conn As New SqlClient.SqlConnection
End Module
5) Using Data Grid control, display all the contents in the table courses, when a Visual Basic.NET
application is executed. On clicking a particular row or column that particular course details for
which the user has selected should be displayed in the corresponding text boxes.
GroupBox1.Visible = True
TextBox1.Text =
dt.Rows(DataGridView1.CurrentRow.Index).Item(0)
TextBox2.Text =
dt.Rows(DataGridView1.CurrentRow.Index).Item(1)
TextBox3.Text =
dt.Rows(DataGridView1.CurrentRow.Index).Item(2)
TextBox4.Text =
dt.Rows(DataGridView1.CurrentRow.Index).Item(3)
6) Create a table called enquiry with the fields, applicant name, course opted for, mobile number,
date of enquiry and comments. Design a form in VB.NET with these fields and it should have
option to add new enquiry, and search options like search by name of the applicant, date of enquiry
and view all enquiry. Use menu edition, Data Grid, and MDI form to do the question?
Form1.Show()
Form2.Show()
dt.Clear() dt.Clear()
connect() connect()
conn.Open() conn.Open()
comm.CommandText = "select * from enquiry where comm.CommandText = "select * from enquiry where
applicant_name like '" & TextBox1.Text & "%" & "'" date_of_enquiry='" & Format(DateTimePicker1.Value,
comm.CommandType = CommandType.Text "dd/MM/yyyy") & "'"
comm.Connection = conn comm.CommandType = CommandType.Text
adp.SelectCommand = comm comm.Connection = conn
adp.Fill(dt) adp.SelectCommand = comm
DataGridView1.DataSource = dt adp.Fill(dt)
conn.Close() if dt.rows.count=0 then
else
DataGridView1.DataSource = dt
End if
conn.Close()
TextBox2_TextChanged event
connect()
conn.Open()
comm.CommandText = "select * from enquiry
where mobile_number like '" & TextBox2.Text & "%" &
"'"
comm.CommandType = CommandType.Text
comm.Connection = conn
adp.SelectCommand = comm
adp.Fill(dt)
DataGridView1.DataSource = dt
conn.Close()
Click event of the “view all enquiry” linked textbox
GroupBox5.Visible = True
GroupBox2.Visible = False
GroupBox3.Visible = False
GroupBox4.Visible = False
dt.Clear()
connect()
conn.Open()
Module Title: Advanced
comm.CommandText = "select *Visual Programming
from enquiry" (Vb.Net) Assignment Title: Database
comm.CommandType
Programming = CommandType.Text
comm.Connection = conn
Student Id: MIDSE
adp.SelectCommand 552
= comm Student Name:
Mohamed
adp.Fill(dt) Hassan
DataGridView1.DataSource = dt
conn.Close()
11
Module Module1
Public conn As New SqlClient.SqlConnection
Public Sub connect()
conn.ConnectionString = "initial catalog=IBS;data source=MHASAN;user id=sa;password=sa;"
End Sub
End Module
7) Follow the procedure as said in question 6 and on displaying the details in the corresponding
text boxes, the Course ID text box should be disabled. On making the necessary editing, and when
the user presses the update button, the newly updated records from the form should be updated to
the table as well as Grid values / details should be updated automatically?
“Gridvalues” function
dt.Clear()
connect()
conn.Open()
comm.CommandText = "select * from enquiry"
comm.CommandType = CommandType.Text
comm.Connection = conn
adp.SelectCommand = comm
adp.Fill(dt)
DataGridView1.DataSource = dt
conn.Close()
GroupBox1.Enabled = False
gridvalues()
GroupBox1.Enabled = True
ComboBox1.Enabled = False
TextBox1.Text = dt.Rows(DataGridView1.CurrentRow.Index).Item(0)
ComboBox1.Text = dt.Rows(DataGridView1.CurrentRow.Index).Item(1)
TextBox2.Text = dt.Rows(DataGridView1.CurrentRow.Index).Item(2)
TextBox3.Text = dt.Rows(DataGridView1.CurrentRow.Index).Item(3)
RichTextBox1.Text = dt.Rows(DataGridView1.CurrentRow.Index).Item(4)
connect()
conn.Open()
comm.CommandText = "update enquiry set
applicant_name='" & TextBox1.Text &
"',mobile_number='" & TextBox2.Text &
"',date_of_enquiry='" & TextBox3.Text &
"',comments='" & RichTextBox1.Text & "' where
course_opted='" & ComboBox1.Text & "'"
comm.CommandType = CommandType.Text
comm.Connection = conn
adp.SelectCommand = comm
adp.Fill(dt)
conn.Close()
MsgBox("record updated")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
ComboBox1.Text = ""
RichTextBox1.Text = ""
gridvalues() adp.Fill(dt)
conn.Close()
Module Module1
Public conn As New SqlClient.SqlConnection
Public Sub connect()
conn.ConnectionString = "initial catalog=IBS;data source=MHASAN;user id=sa;password=sa;"
End Sub
End Module
8) Follow the procedure as said in question 6 and on displaying the details in the corresponding
text boxes, the Course ID textbox should be disabled. Create a button with the caption “Delete”
and on pressing the “Delete” button that particular record should be deleted from the table. As
well as the Grid values / details should be updated automatically?
GroupBox1.Enabled = False
gridvalues()
“gridvalues” Function
dt.Clear()
connect()
conn.Open()
comm.CommandText = "select * from enquiry"
comm.CommandType = CommandType.Text
comm.Connection = conn
adp.SelectCommand = comm
adp.Fill(dt)
DataGridView1.DataSource = dt
conn.Close()
ComboBox1.Enabled = False
GroupBox1.Enabled = True
TextBox1.Text = dt.Rows(DataGridView1.CurrentRow.Index).Item(0)
ComboBox1.Text = dt.Rows(DataGridView1.CurrentRow.Index).Item(1)
TextBox2.Text = dt.Rows(DataGridView1.CurrentRow.Index).Item(2)
TextBox3.Text = dt.Rows(DataGridView1.CurrentRow.Index).Item(3)
RichTextBox1.Text = dt.Rows(DataGridView1.CurrentRow.Index).Item(4)
dt.Clear()
connect()
conn.Open()
comm.CommandText = "delete enquiry where course_opted='" & ComboBox1.Text & "'"
comm.CommandType = CommandType.Text
comm.Connection = conn
adp.SelectCommand = comm
adp.Fill(dt)
conn.Close()
MsgBox("record deleted")
Module Title: Advanced Visual Programming (Vb.Net)
gridvalues() Assignment Title: Database
TextBox1.Text
Programming = ""
TextBox2.Text = ""
Student Id: MIDSE
TextBox3.Text = "" 552 Student Name:
ComboBox1.Text
Mohamed = ""
Hassan
RichTextBox1.Text = ""
16
Module Module1
Public conn As New SqlClient.SqlConnection
Public Sub connect()
conn.ConnectionString = "initial catalog=IBS;data source=MHASAN;user id=sa;password=sa;"
End Sub
End Module
9) Design a simple application using VB.NET for library Management where the should be options
for
a) Adding books
b) Searching books by
i) Name
II) ID
III) Publisher
IV) Author
d) Delete a book
e) Issues
f) Returns
g) Members
i) add member
Module Title: Advanced Visual Programming (Vb.Net) Assignment Title: Database
Programming
Student Id: MIDSE 552 Student Name:
Mohamed Hassan
17
1) by Name
2) By ID
While member makes a book request the system should check whether the member has already
borrowed the maximum book or not. If not the system should check whether the book is available in
the stock. If so issues have to be recorded. While a member returns a book the system should check
whether the due_date has exceeded or not. If so the corresponding fine has to be calculated. For
each day exceeded the fine should be 50 laaree. While adding a member along with the details, add
the photo of the member to the database using the image tool.
Generate a Report for the Fine collected, and member details using crystal report. The
should be functions like
Login
Click eventform
of the “login” button Clikc event of the “Cancel” button
Mdiparent form
Imports System.Windows.Forms
End Sub
End Sub
Else
connect()
Form load event (generating auto increment book number) conn.Open()
TextBox1.Enabled = False comm.CommandText = "insert into book values('" &
connect() TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text &
conn.Open() "','" & TextBox4.Text & "'," & TextBox5.Text & ",'" &
comm.CommandText = "select * from book" TextBox6.Text & "')"
comm.CommandType = CommandType.Text comm.CommandType = CommandType.Text
comm.Connection = conn comm.Connection = conn
adp.SelectCommand = comm comm.ExecuteNonQuery()
adp.Fill(dt) conn.Close()
Dim id, bid As String MsgBox("Record added")
Dim newid, rowcount As Integer TextBox1.Text = " "
rowcount = dt.Rows.Count TextBox2.Text = " "
TextBox3.Text = " "
If rowcount = 0 Then TextBox4.Text = " "
TextBox1.Text = "B001" TextBox5.Text = " "
Module
Else Title: Advanced Visual Programming (Vb.Net) Assignment Title: Database
TextBox6.Text = " "
Programming
id = dt.Rows(rowcount - 1).Item(0) End If
newid = id.Substring(3,
Student Id: MIDSE 552 1) + 1 Student Name:
bid = id.Substring(0, 3)
Mohamed Hassan
TextBox1.Text = bid & newid
End If
conn.Close()
22
End class
gridvalues function
Cell click event of “DataGridView1”
Public Sub gridvalues()
dt.Clear()
GroupBox1.Visible = True
connect()
TextBox1.Enabled = False
conn.Open() =
TextBox1.Text
comm.CommandText = "select * from book"
dt.Rows(DataGridView1.CurrentRow.Index).Item(0)
comm.CommandType
TextBox2.Text = = CommandType.Text
comm.Connection = conn
dt.Rows(DataGridView1.CurrentRow.Index).Item(1)
adp.SelectCommand
TextBox3.Text = = comm
adp.Fill(dt)
Module Title: Advanced Visual Programming (Vb.Net) Assignment
DataGridView1.DataSource = dt
Title: Database
dt.Rows(DataGridView1.CurrentRow.Index).Item(2)
TextBox4.Text =
Programming conn.Close()
dt.Rows(DataGridView1.CurrentRow.Index).Item(3)
End Sub
TextBox5.Text =
Student Id: MIDSE 552 Student Name:
dt.Rows(DataGridView1.CurrentRow.Index).Item(4)
Mohamed Hassan TextBox6.Text =
dt.Rows(DataGridView1.CurrentRow.Index).Item(5)
Button1.Text = buttontext
23
Click event of the button ( if the Mdiparents book edit is pressed then button text become “edit” . if the Mdiparents book delete is
pressed then button text become “delete”)
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
End class
dt.Clear()
connect()
conn.Open()
comm.CommandText = "select * from book where isbn
like '" & TextBox6.Text & "%" & "'"
comm.CommandType = CommandType.Text
comm.Connection = conn
adp.SelectCommand = comm
adp.Fill(dt)
DataGridView1.DataSource = dt
Module Title: Advanced Visual Programming (Vb.Net) Assignment Title: Database
conn.Close()
Programming
Student Id: MIDSE 552 Student Name:
Mohamed Hassan
26
GroupBox4.Visible = False
GroupBox5.Visible = False
GroupBox6.Visible = False
GroupBox7.Visible = False
GroupBox8.Visible = True
GroupBox9.Visible = True
ComboBox1.Items.Add("Yes")
ComboBox1.Items.Add("No")
End Sub
comm.Connection = conn
adp.SelectCommand = comm
adp.Fill(dt)
DataGridView1.DataSource = dt
conn.Close()
End Sub
dt.Clear() Label14.Text =
connect() dt.Rows(DataGridView1.CurrentRow.Index).Item(0)
conn.Open() Label15.Text =
comm.CommandText = "select * from member where member_id like '" & dt.Rows(DataGridView1.CurrentRow.Index).Item(1)
TextBox1.Text & "%" & "'" Label16.Text =
Member_search
comm.CommandType form (To search members)
= CommandType.Text dt.Rows(DataGridView1.CurrentRow.Index).Item(2)
comm.Connection = conn Label17.Text =
adp.SelectCommand = comm dt.Rows(DataGridView1.CurrentRow.Index).Item(3)
adp.Fill(dt) Label18.Text =
GroupBox9.Visible = True dt.Rows(DataGridView1.CurrentRow.Index).Item(4)
If dt.Rows.Count = 0 Then Label19.Text =
Else dt.Rows(DataGridView1.CurrentRow.Index).Item(5)
Module Title: Advanced
DataGridView1.DataSource = dt Visual Programming (Vb.Net) PictureBox1.Image
Assignment = Title: Database
Programming
Label14.Text = dt.Rows(0).Item(0) Image.FromFile(dt.Rows(DataGridView1.CurrentRow.Index).Ite
Label15.Text = dt.Rows(0).Item(1) m(6))
Student Id: MIDSE
Label16.Text 552
= dt.Rows(0).Item(2) End Sub Student Name:
Label17.Text = dt.Rows(0).Item(3)
Mohamed Hassan
Label18.Text = dt.Rows(0).Item(4)
Label19.Text = dt.Rows(0).Item(5)
PictureBox1.Image = Image.FromFile(dt.Rows(0).Item(6))
End If
31
DataGridView1.DataSource = dt
Label14.Text = dt.Rows(0).Item(0)
Label15.Text = dt.Rows(0).Item(1)
Label16.Text = dt.Rows(0).Item(2)
Label17.Text = dt.Rows(0).Item(3)
Label18.Text = dt.Rows(0).Item(4)
Label19.Text = dt.Rows(0).Item(5)
PictureBox1.Image = Image.FromFile(dt.Rows(0).Item(6))
End If
conn.Close()
End Sub
comm.CommandText = "select * from member where present_address like '" & TextBox4.Text & "%" & "'"
comm.CommandType = CommandType.Text
comm.Connection = conn
adp.SelectCommand = comm
adp.Fill(dt)
DataGridView1.DataSource = dt
If dt.Rows.Count = 0 Then
Else
DataGridView1.DataSource = dt
GroupBox9.Visible = True
Label14.Text = dt.Rows(0).Item(0)
Label15.Text = dt.Rows(0).Item(1)
Label16.Text = dt.Rows(0).Item(2)
Label17.Text = dt.Rows(0).Item(3)
Label18.Text = dt.Rows(0).Item(4)
Label19.Text = dt.Rows(0).Item(5)
PictureBox1.Image = Image.FromFile(dt.Rows(0).Item(6))
End If
conn.Close()
End Sub
gridvalues()
dt.Clear()
connect()
conn.Open()
comm.CommandText = "select * from member"
comm.CommandType = CommandType.Text
comm.Connection = conn
adp.SelectCommand = comm
adp.Fill(dt)
DataGridView1.DataSource = dt
conn.Close()
dt3.Clear()
connect()
conn.Open()
comm.CommandText = "select * from issue where book_id='" &
TextBox2.Text & "'"
comm.CommandType = CommandType.Text
comm.Connection = conn
adp.SelectCommand = comm
adp.Fill(dt3)
If dt3.Rows.Count = 1 Then
MsgBox("book is not availble")
TextBox2.Text = ""
Else
MsgBox("Book Available")
TextBox2.Enabled = True
Button1.Enabled = True
Label8.Text = login.fname
End If
Click event of the “Add” button conn.Close()
dt.Clear()
connect()
conn.Open()
comm.CommandText = "insert into issue values('" &
TextBox1.Text & "','" & TextBox2.Text & "','" & Label5.Text & "','"
& Label6.Text & "','" & Label8.Text & "')"
comm.CommandType = CommandType.Text
comm.Connection = conn
comm.ExecuteNonQuery()
conn.Close()
MsgBox("book issued")
TextBox1.Text = ""
TextBox2.Text = ""
Label5.Text = ""
Label6.Text = ""
Label8.Text = ""
TextBox2.Enabled = False
Button1.Enabled = False
Button2.Enabled = False
returns form ( to keep records of the fines collected and to return books )
dt.Clear()
connect()
conn.Open()
comm.CommandText = "select * from issue where book_id='"
& TextBox1.Text & "'"
comm.CommandType = CommandType.Text
comm.Connection = conn
adp.SelectCommand = comm
adp.Fill(dt)
Label7.Text = dt.Rows(0).Item(0)
Label8.Text = dt.Rows(0).Item(3)
return_date = Label8.Text
Label9.Text = Format(Date.Now, "MM/dd/yyyy")
returned_date = Label9.Text
dayselapsed = DateDiff(DateInterval.Day, return_date,
returned_date, FirstDayOfWeek.Sunday)
If dayselapsed > 14 Then
fine = 0.5 * dayselapsed
Label11.Text = Format(fine, "#.00")
Label10.Text = dayselapsed
Button1.Visible = True
conn.Close()
Else
Label10.Text = "0"
Label11.Text = "0"
dt.Clear()
conn.Close()
connect()
conn.Open()
comm.CommandText = "delete from issue where
book_id='" & TextBox1.Text & "'"
comm.CommandType = CommandType.Text
comm.Connection = conn
adp.SelectCommand = comm
adp.Fill(dt)
conn.Close()
MsgBox("book returned")
conn.Close()
End If
dt.Clear()
connect()
conn.Open()
comm.CommandText = "insert into fine values('" & TextBox1.Text
& "','" & Label7.Text & "', '" & Label8.Text & "','" & Label9.Text & "',"
& Label10.Text & "," & Label11.Text & ")"
comm.CommandType = CommandType.Text
comm.Connection = conn
comm.ExecuteNonQuery()
conn.Close()
MsgBox("fine details added")
conn.Close()
dt.Clear()
connect()
conn.Open()
comm.CommandText = "delete from issue where book_id='" &
TextBox1.Text & "'"
comm.CommandType = CommandType.Text
comm.Connection = conn
adp.SelectCommand = comm
adp.Fill(dt)
conn.Close()
MsgBox("book returned")
conn.Close()
TextBox1.Text = ""
Label7.Text = ""
Label8.Text = ""
Label9.Text
Declarations = ""
for the form
Module ClassTitle:
Label10.Text
Public Advanced Visual Programming
returns= "" (Vb.Net) Assignment Title: Database
DimLabel11.Text
comm As =
New ""
Programming SqlClient.SqlCommand
Dim adp As New SqlClient.SqlDataAdapter
Student
Dim
form dt As
load Id:
NewMIDSE
event DataTable 552 Student Name:
Dim dayselapsed As Integer
Mohamed Hassan
Dim return_date, returned_date As Date
Button1.Visible = False
Dim fine As Double
End class
41
TextBox1.Enabled = False
TextBox2.Enabled = False
ComboBox1.Enabled = False
Button1.Enabled = False
gridvalues()
ComboBox1.Items.Add("user")
ComboBox1.Items.Add("administrator")
DateTimePicke2_CloseUp Event
dt.Clear()
connect()
conn.Open()
comm.CommandText = "select * from fine where
returned_date>='" & startdate & "' and returned_date<='" &
enddate & "'"
Module Title: Advanced
comm.CommandType Visual Programming (Vb.Net)
= CommandType.Text Assignment Title: Database
Programming
comm.Connection = conn
DateTimePicker1_CloseUp Event
adp.SelectCommand = comm
Student Id: MIDSE 552
adp.Fill(dt) Student Name:
Dim rpt AsHassan
New CrystalReport1 startdate = Format(DateTimePicker1.Value, "MM/dd/yyyy")
Mohamed
rpt.SetDataSource(dt)
CrystalReportViewer1.ReportSource = rpt
conn.Close()
45
report_day form (to generate fine collected amount for a particular day)
connect()
conn.Open()
comm.CommandText = "select * from fine where returned_date='" & ddate & "'"
comm.CommandType
Module Title: Advanced= CommandType.Text
Visual Programming (Vb.Net) Assignment Title: Database
comm.Connection = conn
Programming
adp.SelectCommand = comm
adp.Fill(dt)
Student
Dim rpt2Id: MIDSE
As New 552
CrystalReport2 Student Name:
Mohamed Hassan
rpt2.SetDataSource(dt)
CrystalReportViewer1.ReportSource = rpt2
conn.Close()
46
report_member_id form (to generate report for member details by searching for a given
member id)
dt.Clear()
connect()
conn.Open()
comm.CommandText = "select * from member where member_id='" &
TextBox1.Text
Module & "'" Advanced Visual Programming (Vb.Net)
Title: Assignment Title: Database
comm.CommandType = CommandType.Text
Programming
comm.Connection = conn
adp.SelectCommand = comm
Student Id: MIDSE 552
adp.Fill(dt) Student Name:
Mohamed
Dim rpt3 AsHassan
New CrystalReport3
rpt3.SetDataSource(dt)
CrystalReportViewer1.ReportSource = rpt3
conn.Close()