Skip to content

Commit bd0a2ab

Browse files
committed
Fix Commandtype determination logic
Stored procedure command type should not have exec in query string. Will execute as stored procedure if query is single word.
1 parent 8f7b63a commit bd0a2ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Src/DbQueryUtility/Repository/SqlDbQueryRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public XDocument Query(string query, string configurationKey)
2222
{
2323
using (SqlCommand command = new SqlCommand(query, connection))
2424
{
25-
if(query.ToLower().StartsWith("exec"))
25+
if(query.Split(' ').Count() == 0)
2626
{
2727
command.CommandType = System.Data.CommandType.StoredProcedure;
2828
}

0 commit comments

Comments
 (0)