[英]Using Access yes/no in where clause of a SqlDataSource
I'm trying to populate a dropdownlist control using a SqlDataSource
. 我正在尝试使用
SqlDataSource
填充dropdownlist控件。 The data source has a WHERE
clause to a yes/no column in access. 数据源在访问中的yes / no列中有一个
WHERE
子句。 However when I run the website the DropDownlist control does not populate, even after control.bind
in pageload
. 但是,当我运行网站时,即使在
pageload
control.bind
之后,也不会填充DropDownlist控件。
Question is: 问题是:
In creating the SqlDatasource
, which source should I use for a column that has yes/no types to resolve this? 在创建
SqlDatasource
,对于具有yes / no类型的列,我应该使用哪个源来解决此问题?
If you have an Access database, why not use the System.Data.Odbc
or maybe even System.Data.OleDb
connections instead of System.Data.Sql
. 如果您有Access数据库,为什么不使用
System.Data.Odbc
甚至System.Data.OleDb
连接而不是System.Data.Sql
。
Check this possibility, too: When using the System.Data.Sql
driver, you may find there are connection specific properties for accessing Microsoft Access databases--so do some reading on this in the MSDN. 还要检查这种可能性:使用
System.Data.Sql
驱动程序时,您可能会发现有用于访问Microsoft Access数据库的特定于连接的属性-因此,请在MSDN中对此进行一些阅读。
A yes
/ no
column is simply a Boolean
column in SQL Server parlance. 在SQL Server中,
yes
/ no
列只是Boolean
列。 In Access, you can set yes
/ no
columns to the following values: (yes, true, 1)|(no, false, 0). 在Access中,可以将
yes
/ no
列设置为以下值:(yes,true,1)|(no,false,0)。 I believe in T-SQL for SQL Server, Boolean columns must be either: (true, 1)|(false, 0). 我相信在用于SQL Server的T-SQL中,布尔列必须为:(true,1)|(false,0)。
HTH. HTH。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.