您的位置:首页 > 数据库

获取SQL命令字符串中的参数名列表

2008-06-04 13:58 417 查看
1//清除命令字符串中的所有字符串

2string commandTextNoString = Regex.Replace(command.CommandText, @"['][\S]*[']", "");

3

4Regex regex = new Regex(@"@[^,\s)]*");

5//获取参数名列表

6MatchCollection matchs = regex.Matches(commandTextNoString);

7

matchs里面包含了在CommandText中使用的所有参数名称
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: