Input parameter in AccessDataSourcehttp://forums.asp.net/t/1769276.aspx/1?Input+parameter+in+AccessDataSourceWed, 15 Feb 2012 05:00:07 -050017692764831136http://forums.asp.net/p/1769276/4831136.aspx/1?Input+parameter+in+AccessDataSourceInput parameter in AccessDataSource <p>Hi,</p> <p>I just joined this forum since I'm stucked with the following code in my Access DB, which I have been trying to load list of active project in my MDB database.&nbsp;The purpose of selecting the list is to filter / limit the user so they didn't input data to in-active project.&nbsp;So far this is what I got, but it always came up with all the project eventhough I have marked them as in-active. The structure of the table is simple, only Project ID (Identity), Project Code (String), Project Name (String), Project Status (Yes/No)</p> <p>Appreciate any help from all you guys. Regards, Sea</p> <p>PS: I didn't use vb code behind or other setting since this is not my original program, I just want to modify this to sync with my other DB&nbsp;</p> <pre class="prettyprint">&lt;asp:AccessDataSource ID=&quot;dbsReadProjects&quot; runat=&quot;server&quot; DataFile=&quot;~/timesheet.mdb&quot; SelectCommand=&quot;SELECT ProjectCode, ProjectName, ProjectStatus FROM Projects WHERE ProjectStatus = True ORDER BY ProjectName&quot;&gt; &lt;/asp:AccessDataSource&gt; &lt;asp:DropDownList ID=&quot;NewProject&quot; runat=&quot;server&quot; DataSourceID=&quot;dbsReadProjects&quot; DataTextField=&quot;ProjectName&quot; DataValueField=&quot;ProjectCode&quot;&gt; &lt;/asp:DropDownList&gt;</pre> 2012-02-14T08:15:15-05:004831147http://forums.asp.net/p/1769276/4831147.aspx/1?Re+Input+parameter+in+AccessDataSourceRe: Input parameter in AccessDataSource <p>Try</p> <pre class="prettyprint">WHERE ProjectStatus = Yes</pre> <p>instead <img src="http://forums.asp.net/scripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif" alt="Laughing" title="Laughing" border="0"></p> 2012-02-14T08:19:54-05:004831165http://forums.asp.net/p/1769276/4831165.aspx/1?Re+Input+parameter+in+AccessDataSourceRe: Input parameter in AccessDataSource <p>No luck here. still in-active project were listed in the dropdownlist&nbsp;</p> <p>I have tried to put ProjectStatus = 1, ProjectStatus = 'True' as well.&nbsp;</p> <p>Or is there any way such as put &quot;Select ProjectCode, ProjectName, ProjectStatus FROM Projects WHERE (ProjectStatus = ?) ORDER by ProjectName&quot;</p> <p>And i put &quot;&lt;SelectParameters&gt;&quot; syntax? Is it possible?&nbsp;</p> 2012-02-14T08:29:32-05:004831225http://forums.asp.net/p/1769276/4831225.aspx/1?Re+Input+parameter+in+AccessDataSourceRe: Input parameter in AccessDataSource <p>That ofcourse will be better</p> <p>try this</p> <pre>&lt;asp:AccessDataSource ID=&quot;<i>ID</i>&quot; ......&gt; &lt;SelectParameters&gt; &lt;asp:Parameter DefaultValue=&quot;<i>hardCodedValue</i>&quot; Name=&quot;<i>parameterName</i>&quot; Type=&quot;<i>dataType</i>&quot; /&gt; &lt;/SelectParameters&gt; &lt;/asp:AccessDataSource&gt;</pre> 2012-02-14T08:55:25-05:004831232http://forums.asp.net/p/1769276/4831232.aspx/1?Re+Input+parameter+in+AccessDataSourceRe: Input parameter in AccessDataSource <p>&lt;asp:AccessDataSource ID=&quot;dsId&quot; runat=&quot;server&quot;&gt;&lt;SelectParameters &gt;<br> &lt;asp:Parameter Type=&quot;Boolean&quot; DefaultValue=&quot;True&quot;/&gt;<br> &lt;/SelectParameters&gt;&lt;/asp:AccessDataSource&gt;</p> 2012-02-14T08:58:34-05:004832531http://forums.asp.net/p/1769276/4832531.aspx/1?Re+Input+parameter+in+AccessDataSourceRe: Input parameter in AccessDataSource <p>Have done the following for the code, but it's funny coz the data is not displayed properly.<br> Is there anything else I should check that might interfere with the dropdownlist?</p> <p><em>&lt;asp:AccessDataSource ID=&quot;dbsReadProjects&quot; runat=&quot;server&quot; DataFile=&quot;~/timesheet.mdb&quot; </em><br> <em>SelectCommand=&quot;SELECT [ProjectCode], [ProjectName], [ProjectStatus] FROM [Projects] WHERE ([ProjectStatus] = ?) ORDER BY ProjectName&quot;&gt;</em><br> <em>&lt;SelectParameters&gt;</em><br> <em>&lt;asp:Parameter Type=&quot;Boolean&quot; DefaultValue=&quot;True&quot; /&gt;</em><br> <em>&lt;/SelectParameters&gt;</em><br> <em>&lt;/asp:AccessDataSource&gt;</em></p> <p><em>&lt;asp:DropDownList ID=&quot;NewProject&quot; runat=&quot;server&quot; DataSourceID=&quot;dbsReadProjects&quot; DataTextField=&quot;ProjectName&quot; DataValueField=&quot;ProjectCode&quot;&gt;&lt;/asp:DropDownList&gt;</em></p> 2012-02-15T00:34:41-05:004832808http://forums.asp.net/p/1769276/4832808.aspx/1?Re+Input+parameter+in+AccessDataSourceRe: Input parameter in AccessDataSource <p>Pardon me but there is something weird just happenned to the code and the database.<br> Just now I decided to get fresh copy of the database and redo the code again, and it works just fine.<br> Don't know exactly what happened, but I'm now moved on to the next step of the project.<br> Thank you for all the help, especially for Muhammad. It's definitely boost my interest to learn more.</p> <p>Once again thanks, and I will mark this thread as ANSWER.</p> <p>Regards, Sea&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> 2012-02-15T05:00:07-05:00