作者在 2011-08-10 17:36:16 发布以下内容
我写了一个存储过程如下:
USE [ChargeIslandData1]
GO
/****** 对象: StoredProcedure [dbo].[Query_UserOperationInformation] 脚本日期: 08/10/2011 17:32:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[Query_UserOperationInformation]
-- Add the parameters for the stored procedure here
(
@UserName varchar(50),
@StartTime datetime,
@EndTime datetime
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @ID uniqueidentifier
-- Insert statements for procedure here
SELECT @ID,u.UserName ,o.Time,c.OperateContent from UserInfo as u
left join UserOperateInfoTable as o on u.ID=o.UserID
left join OperationCodeTable as c on o.OperationalRecords=c.ID
where u.UserName=@UserName and o.Time>=@StartTime and o.Time<=@EndTime
END
GO
/****** 对象: StoredProcedure [dbo].[Query_UserOperationInformation] 脚本日期: 08/10/2011 17:32:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[Query_UserOperationInformation]
-- Add the parameters for the stored procedure here
(
@UserName varchar(50),
@StartTime datetime,
@EndTime datetime
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @ID uniqueidentifier
-- Insert statements for procedure here
SELECT @ID,u.UserName ,o.Time,c.OperateContent from UserInfo as u
left join UserOperateInfoTable as o on u.ID=o.UserID
left join OperationCodeTable as c on o.OperationalRecords=c.ID
where u.UserName=@UserName and o.Time>=@StartTime and o.Time<=@EndTime
END
不知在vc中如何条用这个存储过程