mysql text字段 like_使用like查询text类型字段

public bool Exists(GetReadType GRT, ClientMessageGetRead TypeID, string MessageID, stringUserID)

{int ThisGRT =Convert.ToInt32(GRT);int ThisTypeID =Convert.ToInt32(TypeID);string strSql = @"select

count(1)

from

Client_Message_GetRead

where

GetRead = @GetRead

and

TypeID = @TypeID

and

MessageID like '%'+@MessageID+'%'

and

UserID = @UserID";

SqlParameter[] parameters={new SqlParameter("@GetRead", SqlDbType.Int,4),new SqlParameter("@TypeID", SqlDbType.Int,4),new SqlParameter("@MessageID", SqlDbType.Char,36),new SqlParameter("@UserID", SqlDbType.Char,36)

};

parameters[0].Value =ThisGRT;

parameters[1].Value =ThisTypeID;

parameters[2].Value =MessageID;

parameters[3].Value =UserID;returnDbHelperSQL.Exists(strSql.ToString(), parameters);

} public DataSet NotExists1(GetReadType GRT, string CompanyID, stringUserID)

{int ThisGRT =Convert.ToInt32(GRT);int ThisTypeID =Convert.ToInt32(ClientMessageGetRead.公益团体消息);string strSql = @"select

*

from

Company_Company_Message

where

CompanyID = @CompanyID

and

(

select

top 1 MessageID

from

Client_Message_GetRead

where

GetRead = @GetRead

and

TypeID = @TypeID

and

UserID = @UserID

)

not like '%'+MessageID +'%'";

SqlParameter[] parameters={new SqlParameter("@GetRead", SqlDbType.Int,4),new SqlParameter("@TypeID", SqlDbType.Int,4),new SqlParameter("@CompanyID", SqlDbType.Char,36),new SqlParameter("@UserID", SqlDbType.Char,36)

};

parameters[0].Value =ThisGRT;

parameters[1].Value =ThisTypeID;

parameters[2].Value =CompanyID;

parameters[3].Value =UserID;returnDbHelperSQL.Query(strSql.ToString(), parameters);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值