public static DataSet selectStudent()
{
MySqlConnection conn = connection();
conn.Open();
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = conn;
MySqlDataAdapter adap = new MySqlDataAdapter(@"SELECT person.*, student.gradePointAverage, student.majorField FROM person JOIN student", conn);
MySqlCommandBuilder sqlCmd = new MySqlCommandBuilder(adap);
DataSet sqlSet = new DataSet();
adap.Fill (sqlSet, "studentInfo");
conn.Close();
return sqlSet;
}
Run Code Online (Sandbox Code Playgroud)
和按钮:
private void btnAdminStudentView_Click(object sender, EventArgs e)
{
DataSet ds = studentHelperClass.selectStudent();
dataGridStudent.DataSource = ds.Tables["studentInfo"];
}
Run Code Online (Sandbox Code Playgroud)
为什么这会在按钮点击上给我这样的结果?

我在几个网站上看到了这个,你有内容的前景,在背景中图像滚动比内容慢,这是什么名字?
这是Parallax的一个演示,但就像这个,很多它们似乎是这个4-5窗格的交易,我只是寻找一个图像类型的东西
http://webdesigntutsplus.s3.amazonaws.com/tuts/338_parallax/src/index.html
我已经做了大约1到2个小时的谷歌搜索,这应该是一个非常简单的问题
我需要使用程序GUI中的按钮在我的桌面上启动一个txt doc,例如text.txt(C:\ Users\Computer\Desktop\text.txt).
按钮代码很简单.
JButton btnAddButton1 = new JButton("Display ShopEmployee"); // start of button
btnAddButton1.setVisible( false); // removing from sight
contentPane.add(btnAddButton1);
btnAddButton.addActionListener(new creatingOpenFileListener()); // the button is going to create a Person
btnAddButton.setVisible(true);
Run Code Online (Sandbox Code Playgroud)
和动作监听器:
class creatingOpenFileListener implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
}
}
Run Code Online (Sandbox Code Playgroud)
我尽我所能,但我只是出于想法,我甚至前往第5页谷歌搜索寻找答案应该是一个简单的问题,任何帮助都会很棒,谢谢.
编辑:我的意思是启动,而不是打开GUI中的内容,我发布它就好像我要去点击它自己.
回答
try
{
Desktop.getDesktop().open(new File("C://Users//Computer//Desktop//text.txt"));
}
catch(java.io.IOException e)
{
System.out.println("IOError");
}
Run Code Online (Sandbox Code Playgroud)