日期:2014-05-18 浏览次数:21247 次
SqlConnection thisConnection = new SqlConnection( @"Server=CVRE1WTZRSTAGNW\SQLSERVER2008;Integrated Security=True;Database=gdbranch;"); thisConnection.Open(); SqlCommand cmd=new SqlCommand(); SqlDataAdapter ada = new SqlDataAdapter(); System.Data.DataTable dataTable = new System.Data.DataTable(); cmd.CommandText = @"select a.branchid,a.pkey,a.pno,a.ptime,a.pmemo,a.useid,b.pbarcode,sum(qty) from " + @"pdacheck a inner join pdacheckd b on a.pkey=b.pkey"; ada.SelectCommand = cmd; ada.Fill(dataTable); this.dgData.DataSource = dataTable;