SqlCommand Mysqlcommand = new SqlCommand();
if (MyConnection.State == ConnectionState.Closed)
{
MyConnection.Open();
}
Mysqlcommand.Connection = MyConnection;
Mysqlcommand.CommandText = MysqlQuery;
Mysqlcommand.CommandTimeout = 120;
SqlDataReader MySqlDataReader;
MySqlDataReader = Mysqlcommand.ExecuteReader();
bindingSource4.DataSource = MySqlDataReader;
gridview.DataSource = bindingSource4;
我想将datagridview作为示例图像:
答案 0 :(得分:0)
欢迎使用StackOverflow,
我建议你先在SQL中执行这个命令:
SELECT a.Sr, a.[International Tender], a.Total, b.[Domestic Tender], b.Total,
c.[News Automation],c.Total, d.[News Manual], d.Total
FROM
tableA a
inner join
tableB b
ON a.Sr = b.Sr
inner join
TableC c
ON b.[Domestic Tender] = c.[News Automation]
inner join
TableD d
ON c.[News Automation] = d.[News Manual]
如果符合您的期望,我可以将其转换为C#代码,将其设置为datagridview
来源