C#学生基本信息浏览运行后无法实现上一条,下一条查询问题。
各位大师好,我的代码是这样的;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
//using System.Data;
using System.Data.OleDb;
namespace StudentSystem
{
public partial class Form5 : Form
{
public int num;
public Form5()
{
InitializeComponent();
}
public void baseInfo_load(string s2)
{
if (textBox1.Text == "")
{
MessageBox.Show("请输入学号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
textBox1.Focus(); return;
}
textBox2.Text = ""; textBox3.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; textBox9.Text = ""; textBox10.Text = "";
string s1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb";
OleDbConnection cn = new OleDbConnection(s1);
cn.Open();
OleDbCommand cm = new OleDbCommand(s2, cn);
OleDbDataReader da = cm.ExecuteReader();
while (da.Read())
{
// num = (int)textBox1.Text;
num = (int)Convert.ToInt64(textBox1.Text);
textBox2.Text = da["学号"].ToString().Trim();
textBox3.Text = da["姓名"].ToString().Trim();
textBox4.Text = da["性别"].ToString().Trim();
textBox5.Text = da["民族"].ToString().Trim();