2024-02-13 13:30:17 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
2024-02-13 14:30:26 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.VisualBasic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using Database2;
|
|
|
|
|
|
2024-02-13 13:30:17 -05:00
|
|
|
|
|
|
|
|
|
namespace Database3
|
|
|
|
|
{
|
|
|
|
|
public partial class frmSearch : Form
|
|
|
|
|
{
|
|
|
|
|
public frmSearch()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
2024-02-13 13:34:44 -05:00
|
|
|
|
|
|
|
|
|
private void btnSearch_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2024-02-13 14:30:26 -05:00
|
|
|
|
string studentid = "";
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DataSet ds = new DataSet();
|
|
|
|
|
StudentDataTier stuDT = new StudentDataTier();
|
|
|
|
|
|
|
|
|
|
studentid = txtStuID.Text.Trim();
|
|
|
|
|
|
|
|
|
|
//get the dataset
|
|
|
|
|
ds = stuDT.GetStudents(studentid);
|
|
|
|
|
|
|
|
|
|
// check to see if any record is returned
|
|
|
|
|
if (ds.Tables[0].Rows.Count > 0) //there is a record
|
|
|
|
|
{
|
|
|
|
|
dgvStudents.Visible = true;
|
|
|
|
|
// get data source
|
|
|
|
|
dgvStudents.DataSource = ds.Tables[0];
|
|
|
|
|
dgvStudents.AlternatingRowsDefaultCellStyle.BackColor = Color.LightGreen;
|
|
|
|
|
|
|
|
|
|
// Set the row and column header styles.
|
|
|
|
|
dgvStudents.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
|
|
|
|
|
dgvStudents.ColumnHeadersDefaultCellStyle.BackColor = Color.Green;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
// Handle exception
|
|
|
|
|
}
|
2024-02-13 13:34:44 -05:00
|
|
|
|
}
|
2024-02-13 14:30:26 -05:00
|
|
|
|
|
2024-02-13 13:30:17 -05:00
|
|
|
|
}
|
|
|
|
|
}
|