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. The purpose of selecting the list is to filter / limit the user so they didn't input data to in-active
project. 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)
Appreciate any help from all you guys. Regards, Sea
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
<asp:AccessDataSource ID="dbsReadProjects" runat="server" DataFile="~/timesheet.mdb"
SelectCommand="SELECT ProjectCode, ProjectName, ProjectStatus FROM Projects WHERE ProjectStatus = True ORDER BY ProjectName">
</asp:AccessDataSource>
<asp:DropDownList ID="NewProject" runat="server" DataSourceID="dbsReadProjects"
DataTextField="ProjectName" DataValueField="ProjectCode">
</asp:DropDownList>
Have done the following for the code, but it's funny coz the data is not displayed properly.
Is there anything else I should check that might interfere with the dropdownlist?
<asp:AccessDataSource ID="dbsReadProjects" runat="server" DataFile="~/timesheet.mdb"
SelectCommand="SELECT [ProjectCode], [ProjectName], [ProjectStatus] FROM [Projects] WHERE ([ProjectStatus] = ?) ORDER BY ProjectName"> <SelectParameters> <asp:Parameter Type="Boolean" DefaultValue="True" /> </SelectParameters> </asp:AccessDataSource>
Pardon me but there is something weird just happenned to the code and the database.
Just now I decided to get fresh copy of the database and redo the code again, and it works just fine.
Don't know exactly what happened, but I'm now moved on to the next step of the project.
Thank you for all the help, especially for Muhammad. It's definitely boost my interest to learn more.
Once again thanks, and I will mark this thread as ANSWER.
seageath
Member
31 Points
23 Posts
Input parameter in AccessDataSource
Feb 14, 2012 08:15 AM|LINK
Hi,
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. The purpose of selecting the list is to filter / limit the user so they didn't input data to in-active project. 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)
Appreciate any help from all you guys. Regards, Sea
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
Muhammad Fak...
Contributor
2268 Points
511 Posts
Re: Input parameter in AccessDataSource
Feb 14, 2012 08:19 AM|LINK
Try
instead
If you feel it helps, Mark as answered so that it can help others to find solution.
For Any further questions, please contact me.
seageath
Member
31 Points
23 Posts
Re: Input parameter in AccessDataSource
Feb 14, 2012 08:29 AM|LINK
No luck here. still in-active project were listed in the dropdownlist
I have tried to put ProjectStatus = 1, ProjectStatus = 'True' as well.
Or is there any way such as put "Select ProjectCode, ProjectName, ProjectStatus FROM Projects WHERE (ProjectStatus = ?) ORDER by ProjectName"
And i put "<SelectParameters>" syntax? Is it possible?
Muhammad Fak...
Contributor
2268 Points
511 Posts
Re: Input parameter in AccessDataSource
Feb 14, 2012 08:55 AM|LINK
That ofcourse will be better
try this
<asp:AccessDataSource ID="ID" ......> <SelectParameters> <asp:Parameter DefaultValue="hardCodedValue" Name="parameterName" Type="dataType" /> </SelectParameters> </asp:AccessDataSource>If you feel it helps, Mark as answered so that it can help others to find solution.
For Any further questions, please contact me.
Muhammad Fak...
Contributor
2268 Points
511 Posts
Re: Input parameter in AccessDataSource
Feb 14, 2012 08:58 AM|LINK
<asp:AccessDataSource ID="dsId" runat="server"><SelectParameters >
<asp:Parameter Type="Boolean" DefaultValue="True"/>
</SelectParameters></asp:AccessDataSource>
If you feel it helps, Mark as answered so that it can help others to find solution.
For Any further questions, please contact me.
seageath
Member
31 Points
23 Posts
Re: Input parameter in AccessDataSource
Feb 15, 2012 12:34 AM|LINK
Have done the following for the code, but it's funny coz the data is not displayed properly.
Is there anything else I should check that might interfere with the dropdownlist?
<asp:AccessDataSource ID="dbsReadProjects" runat="server" DataFile="~/timesheet.mdb"
SelectCommand="SELECT [ProjectCode], [ProjectName], [ProjectStatus] FROM [Projects] WHERE ([ProjectStatus] = ?) ORDER BY ProjectName">
<SelectParameters>
<asp:Parameter Type="Boolean" DefaultValue="True" />
</SelectParameters>
</asp:AccessDataSource>
<asp:DropDownList ID="NewProject" runat="server" DataSourceID="dbsReadProjects" DataTextField="ProjectName" DataValueField="ProjectCode"></asp:DropDownList>
seageath
Member
31 Points
23 Posts
Re: Input parameter in AccessDataSource
Feb 15, 2012 05:00 AM|LINK
Pardon me but there is something weird just happenned to the code and the database.
Just now I decided to get fresh copy of the database and redo the code again, and it works just fine.
Don't know exactly what happened, but I'm now moved on to the next step of the project.
Thank you for all the help, especially for Muhammad. It's definitely boost my interest to learn more.
Once again thanks, and I will mark this thread as ANSWER.
Regards, Sea