将数据集传到form2中就可以了:
public class Form1:System.Windows.Forms
{
private DataTable dt=new DataTable();
public Form1()
{}
public void SetData()
{
SqlConnection con=new SqlConnection(...);
SqlCommand cmd=new SqlCommand();
cmd.Connection=con;
cmd.CommandText=".....";
SqlDataAdapter da=new SqlDataAdapter();
da.SelectCommand=cmd;
try
{
da.Fill(dt);
}
catch{}
Form2 f=new Form2(dt);
f.Show();
}
}
public class Form2:System.Windows.Forms
{
private DataTable dt=new DataTable();
public Form2(DataTable dt)
{
this.dt=dt;
}
.
.
.
}