日期:2014-05-17 浏览次数:20672 次
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER proc [dbo].[V_Insert]
@id bigint
as
declare @idExist bit
select @idExist = count(id) from visit where id=@id
begin
if @idExist=0
INSERT INTO visitqq (id) VALUES (@id)
end
return @idExist
ALTER proc [dbo].[V_Insert]
@id bigint
as
IF NOT EXISTS(SELECT 1 FROM visit where id=@id)
INSERT INTO visitqq (id) VALUES (@id)
return @idExist
public static bool Add(Int64 id)
{
SqlParameter[] param = new SqlParameter[]
{
new SqlParameter{ ParameterName="@id", SqlDbType= SqlDbType.BigInt,Value= id}
};
return Convert.ToBoolean(SqlHelper.ExecuteScalar("V_Insert", CommandType.StoredProcedure, param));
}
if (!Sql.Visit.Add(id))
{
lock (loginLock1)
{
recordTotal++;
}