I tried your package in Umbraco v. 7.0.4, but I could get it working to list the results in the dropdown..
I have a table "people" with columns: id, name, address, email, bio ...
I am using a SQL Compact database for this local install and when a use the sql in WebMatrix I get the two colums id and name: SELECT id AS Value, name AS Text FROM people
I am not sure if it require the aliases to be "Value" and "Text" since the html file use this? <select ng-model="model.value" ng-options="c.Value as c.Text for c in sqlResult"></select>
I just get this result: <select ng-model="model.value" ng-options="c.Value as c.Text for c in sqlResult" class="ng-pristine ng-valid"><option value="?" selected="selected"></option> </select>
and a 500 internal server error from the /umbraco/backoffice/SqlDropDownList/SqlDropDownList/ExecuteSql
)]}',
{"Message":"An error has occurred.","ExceptionMessage":"Keyword not supported: 'flush interval'.","ExceptionType":"System.ArgumentException","StackTrace":" at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)\r\n at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules)\r\n at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)\r\n at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)\r\n at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)\r\n at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)\r\n at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)\r\n at System.Data.SqlClient.SqlConnection..ctor(String connectionString, SqlCredential credential)\r\n at System.Data.SqlClient.SqlConnection..ctor(String connectionString)\r\n at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters)\r\n at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(String connectionString, CommandType commandType, String commandText)\r\n at tada.umbV7DataTypes.SqlDropDownList.SqlDropDownListController.ExecuteSql(Object sqlPassed)\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4()\r\n at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)"}
I haven't tested it on anything but SQL Server, so I'm guessing the issue is with SQL Compact. I have it working on a few installs with SQL Server 2008 and 2012 on v7.0.4 and 7.0.2.
You don't need to alias the SQL, it will just take the first two fields and use them in the dropdown. I'll see if I can check it out on SQL Compact sometime and resolve.
Yes, it might be something, which is not supported with SQL Compact..
Another thing I was thinking of when the values are listed in the dropdown.. maybe there should be an option the the settings/configuration to choose if you want a default item in the dropdown.. there might be cases where it should be optional to the editors if they want to choose one if the values..
It now seems to work great with SQL Compact too :) .. and great to have an option to select the default item..
Actually I meant with the default was like in Umbraco v4 and v6 go back to select the item "Choose..." and similar in Umbraco v7. However I find that it more seems to be an Umbraco behavior .. and in v7 after you have saved your node the "default" blank item dissapear and you can't select it back to let it be empty/blank like you could in v4 and v6.
Didn't recieve results in dropdown
Hi..
I tried your package in Umbraco v. 7.0.4, but I could get it working to list the results in the dropdown..
I have a table "people" with columns: id, name, address, email, bio ...
I am using a SQL Compact database for this local install and when a use the sql in WebMatrix I get the two colums id and name: SELECT id AS Value, name AS Text FROM people
I am not sure if it require the aliases to be "Value" and "Text" since the html file use this?
<select ng-model="model.value" ng-options="c.Value as c.Text for c in sqlResult"></select>
I just get this result:
<select ng-model="model.value" ng-options="c.Value as c.Text for c in sqlResult" class="ng-pristine ng-valid"> <option value="?" selected="selected"></option>
</select>
and a 500 internal server error from the /umbraco/backoffice/SqlDropDownList/SqlDropDownList/ExecuteSql
/Bjarne
Hi Bjarne,
I haven't tested it on anything but SQL Server, so I'm guessing the issue is with SQL Compact. I have it working on a few installs with SQL Server 2008 and 2012 on v7.0.4 and 7.0.2.
You don't need to alias the SQL, it will just take the first two fields and use them in the dropdown. I'll see if I can check it out on SQL Compact sometime and resolve.
Okay :)
Yes, it might be something, which is not supported with SQL Compact..
Another thing I was thinking of when the values are listed in the dropdown.. maybe there should be an option the the settings/configuration to choose if you want a default item in the dropdown.. there might be cases where it should be optional to the editors if they want to choose one if the values..
Thanks Bjarne.
Great idea with the default item, I'll look at adding that.
Hey Bjarne,
I uploaded an updated version of the drop down list that should work with SQL compact. It now uses Peta POCO for the query.
I also added options to pre set the selected value and you can now pass in the page id (like you could in uComponents).
Let me know if it works for you in SQL compact. Note that you now need to name the fields as Value and Text (previously you didn't need to).
Thanks
Zac
Hi Zac
It now seems to work great with SQL Compact too :) .. and great to have an option to select the default item..
Actually I meant with the default was like in Umbraco v4 and v6 go back to select the item "Choose..." and similar in Umbraco v7. However I find that it more seems to be an Umbraco behavior .. and in v7 after you have saved your node the "default" blank item dissapear and you can't select it back to let it be empty/blank like you could in v4 and v6.
I have created an issue here: http://issues.umbraco.org/issue/U4-4450
/Bjarne
is working on a reply...