private void button5_Click(object sender, RoutedEventArgs e)
{
//this.Hide();
// MessageBox.Show("登陆成功!!!");
string constr = "server=PC-20150723QMEF;database=dhj;integrated security=SSPI";
SqlConnection con = new SqlConnection(constr);
DataTable dt = new DataTable();
try
{
con.Open();
string sql = "select * from test ";
//SqlCommand cmd = new SqlCommand(sql, con);
DataSet ds = new DataSet();
SqlDataAdapter sda = new SqlDataAdapter(sql, con);
sda.Fill(ds, "test");
dt = ds.Tables["test"];
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
MessageBox.Show("已读取数据");
****return dt;****
con.Close();
Window2 girl = new Window2();
girl.Show();
}