日期:2014-05-18 浏览次数:20392 次
Private Sub Command1_Click() Set db = New ADODB.Connection Set rs = New ADODB.Recordset db.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=lzjc;Data Source=." db.Open If Option1.Value = True Then rs.Open "declare @a varchar(20) set @a=(select DateName(year,GetDate())) select sum(收入) as 第一月销售总金额 from ri where 日期 between LTRIM(@a)+'-9-1' and LTRIM(@a)+'-9-30'", db, adOpenStatic, adLockReadOnly Set DataGrid1.DataSource = rs End If End Sub
declare @a varchar(20) set @a=(select DateName(year,GetDate())) select sum(收入) as 第一月销售总金额 from ri where 日期 between LTRIM(@a)+'-9-1' and LTRIM(@a)+'-9-30'
select sum(收入) as 第一月销售总金额 from ri where 日期 between '2009-9-1' and '2009-9-30'