根据邮件地址查注册用户使用的名字名;
其中。a 的count是没法确定的所以不知道该怎么用存储过程。
List<string> selectinfo = new List<string>();
for (int i = 0; i < a.Count; i++) {
string sqlstr = string.Format("select fldloginName as name from tblUser where fldEmail='{0}'",a[i][0]);
selectInfo.add(sqlstr);
}问: 现在组织好这么多的sql语句,结果集要返回给跟selectInfo.count一样多行的记录。
查询无此记录的返回null,或者""都行这个sql 该怎么组织,要根据结果如果数据库里没返回结果。就要移除a里面的对应的Index的项,该用啥写。把我给拷到了。忘大虾给出思路。给出代码。给出建议。在此先谢过
其中。a 的count是没法确定的所以不知道该怎么用存储过程。
List<string> selectinfo = new List<string>();
for (int i = 0; i < a.Count; i++) {
string sqlstr = string.Format("select fldloginName as name from tblUser where fldEmail='{0}'",a[i][0]);
selectInfo.add(sqlstr);
}问: 现在组织好这么多的sql语句,结果集要返回给跟selectInfo.count一样多行的记录。
查询无此记录的返回null,或者""都行这个sql 该怎么组织,要根据结果如果数据库里没返回结果。就要移除a里面的对应的Index的项,该用啥写。把我给拷到了。忘大虾给出思路。给出代码。给出建议。在此先谢过
select fldloginName as name from tblUser where fldEmail='[email protected]' union all select fldloginName as name from tblUser where fldEmail='60483506' union all select fldloginName as name from tblUser where fldEmail='[email protected]'
name
admin
admin结果指出来两个。而中间的那个语句的结果没了。希望
as
begin
declare @sql varchar(2000)
create table #tab (fldEmail varchar(200))
select @sql='insert into #tab select '''+replace(@intput,',',''' union all select ''')+''' '
exec(@sql) select a.fldEmail,b.fldloginName
from tab a
left join tblUser b
on a.fldEmail=b.fldEmail
end
create proc black2bi(@intput varchar(2000))
as
begin
declare @sql varchar(2000)
create table #tab (fldEmail varchar(200))
select @sql='insert into #tab select '''+replace(@intput,',',''' union all select ''')+''' '
exec(@sql) select a.fldEmail,isnull(b.fldloginName,'') fldloginName
from tab a
left join tblUser b
on a.fldEmail=b.fldEmail
end
create proc black2bi(@intput varchar(2000))
as
begin
declare @sql varchar(2000)
create table #tab (fldEmail varchar(200))
select @sql='insert into #tab select '''+replace(@intput,',',''' union all select ''')+''' '
exec(@sql) select a.fldEmail,isnull(b.fldloginName,'') fldloginName
from #tab a
left join tblUser b
on a.fldEmail=b.fldEmail drop table #tab
end