SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText="SELECT dbo.Sell_User_Manager_Info.Sell_User_Manager_ID,dbo.Sell_User_Manager_Info.Sell_User_Manager_Name, dbo.Sell_User_Area_Info.User_Area_ID,dbo.Sell_User_Area_Info.Sell_User_Area_Name,dbo.Sell_User_Info.Sell_User_ID,dbo.Sell_User_Info.Sell_User_Name,sell_line_info.Sell_Line_ID,dbo.Sell_Line_Info.Sell_Station_Name FROM dbo.Sell_User_Manager_Info INNER JOIN dbo.Sell_User_Area_Info ON dbo.Sell_User_Manager_Info.Sell_User_Manager_ID = dbo.Sell_User_Area_Info.Sell_User_Manager_ID INNER JOIN dbo.Sell_User_Info ON dbo.Sell_User_Area_Info.User_Area_ID=dbo.Sell_User_Info.Sell_User_Area_ID INNER JOIN dbo.Sell_Line_Info ON dbo.Sell_User_Info.Sell_User_ID = dbo.Sell_Line_Info.Sell_User_ID ORDER BY dbo.Sell_User_Manager_Info.Sell_User_Manager_Name,dbo.Sell_User_Area_Info.Sell_User_Area_Name,dbo.Sell_User_Info.Sell_User_Name;";
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sda.Fill(ds);
DataTable dt =ds.Tables[0].DefaultView.ToTable(true, new string[] { "sell_User_id", "sell_User_name","Sell_Line_ID","Sell_Station_Name"});
this.dataGridView1.DataSource = dt;
C#下数据归类的使用
最新推荐文章于 2020-03-15 21:03:31 发布