{"action":"created","issue":{"url":"https://api.github.com/repos/ellisnet/Portable.Data.Sqlite/issues/4","labels_url":"https://api.github.com/repos/ellisnet/Portable.Data.Sqlite/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/ellisnet/Portable.Data.Sqlite/issues/4/comments","events_url":"https://api.github.com/repos/ellisnet/Portable.Data.Sqlite/issues/4/events","html_url":"https://github.com/ellisnet/Portable.Data.Sqlite/issues/4","id":57351353,"number":4,"title":"Multiple instances of the same parameter in sqlite statement fail","user":{"login":"wenyonk","id":3248973,"avatar_url":"https://avatars.githubusercontent.com/u/3248973?v=3","gravatar_id":"","url":"https://api.github.com/users/wenyonk","html_url":"https://github.com/wenyonk","followers_url":"https://api.github.com/users/wenyonk/followers","following_url":"https://api.github.com/users/wenyonk/following{/other_user}","gists_url":"https://api.github.com/users/wenyonk/gists{/gist_id}","starred_url":"https://api.github.com/users/wenyonk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenyonk/subscriptions","organizations_url":"https://api.github.com/users/wenyonk/orgs","repos_url":"https://api.github.com/users/wenyonk/repos","events_url":"https://api.github.com/users/wenyonk/events{/privacy}","received_events_url":"https://api.github.com/users/wenyonk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-02-11T17:51:24Z","updated_at":"2015-03-06T11:59:06Z","closed_at":null,"body":"I have a sqlite statement with the same parameter name (@TimeNow) several times in the statement (shown below), I get a binding exception.  What is happening when the sqlite statement is parsed it adds the parameter name several times and the value once.\r\n\r\nREPIOSITORY CODE:\r\n...\r\n// Create a new sqlite command with the command text and sqlite ado database connection.\r\n   using (var sqliteCommand = new SqliteCommand(XCommands.GetAllWidgetsVisible, sqliteAdoConnection))\r\n    {\r\n         // Add the parameters and values.\r\n         sqliteCommand.Parameters.AddWithValue(ParameterNames.Limit, take);\r\n         sqliteCommand.Parameters.AddWithValue(ParameterNames.Skip, skip);\r\n         var todayDateParm = sqliteCommand.Parameters.Add(ParameterNames.TodayDate, DbType.Date);\r\n         todayDateParm.Value = todayDate;\r\n \r\n         if (!includeHidden)\r\n             sqliteCommand.Parameters.AddWithValue(ParameterNames.TimeNow, DateTime.Now);\r\n \r\n          // Execute the command and return the result sets.\r\n          using (var sqliteDataReader = sqliteCommand.ExecuteReader())\r\n          {\r\n               // Read the next row from the result set.\r\n               while (sqliteDataReader.Read())\r\n               {\r\n                   // Id, Name, Count(*) As ChecklistCount\r\n                   var id = sqliteDataReader.GetInt32(\"Id\");\r\n                   var name = sqliteDataReader.IsDBNull(\"Name\") ? null : sqliteDataReader.GetString(\"Name\");\r\n                   var checklistCount = sqliteDataReader.GetInt32(\"ChecklistCount\");\r\n                   departmentModelListRetVal.Add(newDepartmentModel(id, name, checklistCount));\r\n               }\r\n          }\r\n     }\r\n...\r\n\r\nSQLITE COMMAND:\r\n            @\"SELECT D.Id, D.Name, Count(*) As ChecklistCount\r\n                FROM Departments AS D\r\n          INNER JOIN CheckListDepartments AS CD ON D.Id = CD.DepartmentId\r\n          INNER JOIN CheckListInstances AS CLI ON CD.CheckListId = CLI.CheckListId\r\n                 AND CLI.BusinessDate = @TodayDate AND CLI.IsTemplate = 0 AND CLI.IsCompleted = 0\r\n                 AND ( (StartTime IS NULL AND EndTime IS NULL)\r\n                   OR  (StartTime IS NOT NULL AND EndTime IS NULL AND @TimeNow > StartTime)\r\n                   OR  (StartTime IS NOT NULL AND EndTime IS NOT NULL AND @TimeNow BETWEEN StartTime AND EndTime)\r\n                   OR  (StartTime IS NULL AND EndTime IS NOT NULL AND @TimeNow < EndTime) )\r\n          GROUP BY D.Id, D.Name\r\n          ORDER BY D.Name COLLATE NOCASE \r\n          LIMIT @Limit OFFSET @Skip\";\r\n\r\nParmName         ParmValue\r\n@TodayDate    2015/02/05\r\n@TimeNow      2015/02/05 17:02:35\r\n@TimeNow      NULL\r\n@TimeNow      NULL\r\n@Limit        1000\r\n@Skip         0\r\n\r\nException of type 'Portable.Data.Sqlite.SqliteException' was thrown.\r\n \r\nPortable.Data.Sqlite\r\n   at Portable.Data.Sqlite.SqliteStatement.BindParameter(Int32 index, SqliteParameter param)\r\n   at Portable.Data.Sqlite.SqliteStatement.BindParameters()\r\n   at Portable.Data.Sqlite.SqliteCommand.BuildNextCommand()\r\n   at Portable.Data.Sqlite.SqliteCommand.GetStatement(Int32 index)\r\n   at Portable.Data.Sqlite.SqliteDataReader.NextResult()\r\n   at Portable.Data.Sqlite.SqliteDataReader..ctor(SqliteCommand cmd, Boolean setRowId, CommandBehavior behave, IObjectCryptEngine cryptEngine)\r\n   at Portable.Data.Sqlite.SqliteDataReader..ctor(SqliteCommand cmd, CommandBehavior behave, IObjectCryptEngine cryptEngine)\r\n   at Portable.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)\r\n   at Portable.Data.Sqlite.SqliteCommand.ExecuteReader()\r\n   at SureCheck.Mobile.Shared.Sqlite.Repositories.DepartmentsRepository.GetAllDepartmentModels(DateTime todayDate, Int32 take, Int32 skip, Boolean includeHidden)\r\n"},"comment":{"url":"https://api.github.com/repos/ellisnet/Portable.Data.Sqlite/issues/comments/77548566","html_url":"https://github.com/ellisnet/Portable.Data.Sqlite/issues/4#issuecomment-77548566","issue_url":"https://api.github.com/repos/ellisnet/Portable.Data.Sqlite/issues/4","id":77548566,"user":{"login":"wenyonk","id":3248973,"avatar_url":"https://avatars.githubusercontent.com/u/3248973?v=3","gravatar_id":"","url":"https://api.github.com/users/wenyonk","html_url":"https://github.com/wenyonk","followers_url":"https://api.github.com/users/wenyonk/followers","following_url":"https://api.github.com/users/wenyonk/following{/other_user}","gists_url":"https://api.github.com/users/wenyonk/gists{/gist_id}","starred_url":"https://api.github.com/users/wenyonk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenyonk/subscriptions","organizations_url":"https://api.github.com/users/wenyonk/orgs","repos_url":"https://api.github.com/users/wenyonk/repos","events_url":"https://api.github.com/users/wenyonk/events{/privacy}","received_events_url":"https://api.github.com/users/wenyonk/received_events","type":"User","site_admin":false},"created_at":"2015-03-06T11:59:06Z","updated_at":"2015-03-06T11:59:06Z","body":"Jeremy:\r\n\r\nI have written you several emails since you last checkin, I have called you twice, why are you NOT responding or providing some type of update on this issue?"}}