1 //清除命令字符串中的所有字符串
//清除命令字符串中的所有字符串
2 string commandTextNoString = Regex.Replace(command.CommandText, @"['][\S]*[']", "");
string commandTextNoString = Regex.Replace(command.CommandText, @"['][\S]*[']", "");
3
4 Regex regex = new Regex(@"@[^,\s)]*");
Regex regex = new Regex(@"@[^,\s)]*");
5 //获取参数名列表
//获取参数名列表
6 MatchCollection matchs = regex.Matches(commandTextNoString);
MatchCollection matchs = regex.Matches(commandTextNoString);
7
 //清除命令字符串中的所有字符串
//清除命令字符串中的所有字符串2
 string commandTextNoString = Regex.Replace(command.CommandText, @"['][\S]*[']", "");
string commandTextNoString = Regex.Replace(command.CommandText, @"['][\S]*[']", "");3

4
 Regex regex = new Regex(@"@[^,\s)]*");
Regex regex = new Regex(@"@[^,\s)]*");5
 //获取参数名列表
//获取参数名列表6
 MatchCollection matchs = regex.Matches(commandTextNoString);
MatchCollection matchs = regex.Matches(commandTextNoString);7

matchs里面包含了在CommandText中使用的所有参数名称
 
                    
                     
                    
                 
                    
                 
 
         
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号