日期:2014-05-17 浏览次数:20901 次
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author: wfei
-- Create date: 2013.10.10 15:55
-- Description:
-- =============================================
ALTER PROCEDURE [dbo].[RepeatLogin]
-- Add the parameters for the stored procedure here
@username varchar(15) = null ,
@outResult int = 1 output
AS
declare @view_sql varchar(100)
--object_id函数判断操作员账号不存在(没有的登录)
if OBJECT_ID ('tempdb.dbo.##'+@username )is null
begin
--创建临时表
set @view_sql ='create table ##'+@username+'(username varchar(15))'
exec(@view_sql)
--out参数设置为0(账号没有登录)
set @outResult =0
end
--账号存在
else
--out参数为1
SqlParameter parameter1=new SqlParameter("@username",SqlDbType.VarChar,15);
SqlParameter parameter2 = new SqlParameter("@outResult", SqlDbType.Int);
string name = user.Username;
int k=multipleDB.executeProcess(name,parameter1, parameter2);
MessageBox.Show(k.ToString());
if (k==1)
{
MessageBox.Show("用户已登陆!");
}
else
{
///将登陆日志插入用户日志中
}
public int