J JMW Member Licensed User Longtime User Apr 12, 2017 #1 I'm looking to understand this: Code: Dim m As Map m = DBUtils.ExecuteMap(Starter.sql, "SELECT Project, OriginYear, SurveyType FROM tblProjects WHERE Project = ?", Array As String(spnrProject.SelectedItem, Value)) This results in an error in the log error in ExecuteMap in dbutils on line: cur = SQL.ExecQuery2(Query, StringArgs) java.lang.IllegalArgumentException: Cannot bind argument at index 2 because the index is out of range. The statement has 1 parameters. But the following works: Code: Dim m As Map Dim strProject As String strProject = spnrProject.SelectedItem m = DBUtils.ExecuteMap(Starter.sql, "SELECT Project, OriginYear, SurveyType FROM tblProjects WHERE Project = ?", Array As String(strProject)) Why doesn't the first work?
I'm looking to understand this: Code: Dim m As Map m = DBUtils.ExecuteMap(Starter.sql, "SELECT Project, OriginYear, SurveyType FROM tblProjects WHERE Project = ?", Array As String(spnrProject.SelectedItem, Value)) This results in an error in the log error in ExecuteMap in dbutils on line: cur = SQL.ExecQuery2(Query, StringArgs) java.lang.IllegalArgumentException: Cannot bind argument at index 2 because the index is out of range. The statement has 1 parameters. But the following works: Code: Dim m As Map Dim strProject As String strProject = spnrProject.SelectedItem m = DBUtils.ExecuteMap(Starter.sql, "SELECT Project, OriginYear, SurveyType FROM tblProjects WHERE Project = ?", Array As String(strProject)) Why doesn't the first work?
XbNnX_507 Active Member Licensed User Longtime User Apr 12, 2017 #2 Code: Dim m As Map m = DBUtils.ExecuteMap(Starter.sql, "SELECT Project, OriginYear, SurveyType FROM tblProjects WHERE Project = ?", Array As String(spnrProject.SelectedItem, Value)) This results in an error in the log error in ExecuteMap in dbutils on line: cur = SQL.ExecQuery2(Query, StringArgs) java.lang.IllegalArgumentException: Cannot bind argument at index 2 because the index is out of range. The statement has 1 parameters. It doesnt work because is expecating only one parameter Code: "SELECT Project, OriginYear, SurveyType FROM tblProjects WHERE Project = ?" you are passing two parameters Code: array as string ( sprnProject.selectedItem, value) But the following works: Code: Dim m As Map Dim strProject As String strProject = spnrProject.SelectedItem m = DBUtils.ExecuteMap(Starter.sql, "SELECT Project, OriginYear, SurveyType FROM tblProjects WHERE Project = ?", Array As String(strProject)) It works because you passing one parameter. Upvote 0
Code: Dim m As Map m = DBUtils.ExecuteMap(Starter.sql, "SELECT Project, OriginYear, SurveyType FROM tblProjects WHERE Project = ?", Array As String(spnrProject.SelectedItem, Value)) This results in an error in the log error in ExecuteMap in dbutils on line: cur = SQL.ExecQuery2(Query, StringArgs) java.lang.IllegalArgumentException: Cannot bind argument at index 2 because the index is out of range. The statement has 1 parameters. It doesnt work because is expecating only one parameter Code: "SELECT Project, OriginYear, SurveyType FROM tblProjects WHERE Project = ?" you are passing two parameters Code: array as string ( sprnProject.selectedItem, value) But the following works: Code: Dim m As Map Dim strProject As String strProject = spnrProject.SelectedItem m = DBUtils.ExecuteMap(Starter.sql, "SELECT Project, OriginYear, SurveyType FROM tblProjects WHERE Project = ?", Array As String(strProject)) It works because you passing one parameter.