奇怪疑问 !行集合不能作为标签
[code=SQL][/code]代码如下:
Private Sub Command1_Click()Set db = New ADODB.ConnectionSet rs = New ADODB.Recordsetdb.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=lzjc;Data Source=."db.OpenIf Option1.Value = True Thenrs.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, adLockReadOnlySet DataGrid1.DataSource = rsEnd IfEnd 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'