AccessDataSource not working

  • Thread starter Thread starter Scott Starker
  • Start date Start date
S

Scott Starker

I am using MS Visual Web Developer 2005 Express Edition, MS Access DB, XP
Pro and IIS 5.1 on my local XP Pro.

Why does this work:
<asp:DropDownList ID="cmbcboFiltLanguageID" Style="z-index: 201; left:
640px; position: absolute;
top: 155px" runat="server" Width="377px" Height="20px" BackColor="8454016"
ForeColor="0" AutoPostBack="true" DataSourceID="AccessDataSource4"
DataTextField="FilterLanguageID"
OnSelectedIndexChanged="cmbcboFiltLanguageID_SelectedIndexChanged"
AppendDataBoundItems="True">
<asp:ListItem Value="-1">-- Choose a Language Name --</asp:ListItem>
</asp:DropDownList>
<asp:AccessDataSource ID="AccessDataSource4" runat="server"
DataFile="~/App_Data/pub_db_4_be.mdb"
SelectCommand="SELECT LanguageName & EthnologueCode & EthnologueCodesOld &
LanguageID AS FilterLanguageID FROM Languages WHERE (LanguageName <> '' AND
LanguageName IS NOT NULL AND LanguageNameAlt <> '' AND LanguageNameAlt IS
NOT NULL AND EthnologueCode <> '' AND EthnologueCode IS NOT NULL AND
EthnologueCodesOld <> '' AND EthnologueCodesOld IS NOT NULL) ORDER BY
LanguageName">
</asp:AccessDataSource>

<asp:DropDownList ID="cmbcboFiltEthCode" Style="z-index: 101; left: 641px;
position: absolute;
top: 202px" runat="server" Width="376px" Height="20px" BackColor="8454016"
ForeColor="black" AutoPostBack="true" DataSourceID="AccessDataSource3"
DataTextField="FilterEthCode"
OnSelectedIndexChanged="cmbcboFiltEthCode_SelectedIndexChanged"
AppendDataBoundItems="True">
<asp:ListItem Value="-1">-- Choose an Ethnologue Code --</asp:ListItem>
</asp:DropDownList>
<asp:AccessDataSource ID="AccessDataSource3" runat="server"
DataFile="~/App_Data/pub_db_4_be.mdb">
</asp:AccessDataSource>

and this:

<asp:DropDownList ID="cmbcboFiltLanguageID" Style="z-index: 201; left:
640px; position: absolute;
top: 155px" runat="server" Width="377px" Height="20px" BackColor="8454016"
ForeColor="0" AutoPostBack="true" DataSourceID="AccessDataSource4"
DataTextField="FilterLanguageID"
OnSelectedIndexChanged="cmbcboFiltLanguageID_SelectedIndexChanged"
AppendDataBoundItems="True">
<asp:ListItem Value="-1">-- Choose a Language Name --</asp:ListItem>
</asp:DropDownList>
<asp:AccessDataSource ID="AccessDataSource4" runat="server"
DataFile="~/App_Data/pub_db_4_be.mdb">
</asp:AccessDataSource>

<asp:DropDownList ID="cmbcboFiltEthCode" Style="z-index: 101; left: 641px;
position: absolute;
top: 202px" runat="server" Width="376px" Height="20px" BackColor="8454016"
ForeColor="black" AutoPostBack="true" DataSourceID="AccessDataSource3"
DataTextField="FilterEthCode"
OnSelectedIndexChanged="cmbcboFiltEthCode_SelectedIndexChanged"
AppendDataBoundItems="True">
<asp:ListItem Value="-1">-- Choose an Ethnologue Code --</asp:ListItem>
</asp:DropDownList>
<asp:AccessDataSource ID="AccessDataSource3" runat="server"
DataFile="~/App_Data/pub_db_4_be.mdb"
SelectCommand="SELECT EthnologueCode & EthnologueCodesOld & LanguageName &
LanguageID AS FilterEthCode FROM Languages WHERE (LanguageName <> '' AND
LanguageName IS NOT NULL AND LanguageNameAlt <> '' AND LanguageNameAlt IS
NOT NULL AND EthnologueCode <> '' AND EthnologueCode IS NOT NULL AND
EthnologueCodesOld <> '' AND EthnologueCodesOld IS NOT NULL) ORDER BY
EthnologueCode">
</asp:AccessDataSource>

But not this:

<asp:DropDownList ID="cmbcboFiltLanguageID" Style="z-index: 201; left:
640px; position: absolute;
top: 155px" runat="server" Width="377px" Height="20px" BackColor="8454016"
ForeColor="0" AutoPostBack="true" DataSourceID="AccessDataSource4"
DataTextField="FilterLanguageID"
OnSelectedIndexChanged="cmbcboFiltLanguageID_SelectedIndexChanged"
AppendDataBoundItems="True">
<asp:ListItem Value="-1">-- Choose a Language Name --</asp:ListItem>
</asp:DropDownList>
<asp:AccessDataSource ID="AccessDataSource4" runat="server"
DataFile="~/App_Data/pub_db_4_be.mdb"
SelectCommand="SELECT LanguageName & EthnologueCode & EthnologueCodesOld &
LanguageID AS FilterLanguageID FROM Languages WHERE (LanguageName <> '' AND
LanguageName IS NOT NULL AND LanguageNameAlt <> '' AND LanguageNameAlt IS
NOT NULL AND EthnologueCode <> '' AND EthnologueCode IS NOT NULL AND
EthnologueCodesOld <> '' AND EthnologueCodesOld IS NOT NULL) ORDER BY
LanguageName">
</asp:AccessDataSource>

<asp:DropDownList ID="cmbcboFiltEthCode" Style="z-index: 101; left: 641px;
position: absolute;
top: 202px" runat="server" Width="376px" Height="20px" BackColor="8454016"
ForeColor="black" AutoPostBack="true" DataSourceID="AccessDataSource3"
DataTextField="FilterEthCode"
OnSelectedIndexChanged="cmbcboFiltEthCode_SelectedIndexChanged"
AppendDataBoundItems="True">
<asp:ListItem Value="-1">-- Choose an Ethnologue Code --</asp:ListItem>
</asp:DropDownList>
<asp:AccessDataSource ID="AccessDataSource3" runat="server"
DataFile="~/App_Data/pub_db_4_be.mdb"
SelectCommand="SELECT EthnologueCode & EthnologueCodesOld & LanguageName &
LanguageID AS FilterEthCode FROM Languages WHERE (LanguageName <> '' AND
LanguageName IS NOT NULL AND LanguageNameAlt <> '' AND LanguageNameAlt IS
NOT NULL AND EthnologueCode <> '' AND EthnologueCode IS NOT NULL AND
EthnologueCodesOld <> '' AND EthnologueCodesOld IS NOT NULL) ORDER BY
EthnologueCode">
</asp:AccessDataSource>

The only lines that are different is the SelectCommand's. But they are both
the same as version 1 and 2 in the third version. How is this possible?

Scott
 
You can debug Access SQL statements by using a variable and printing
the output, which you can then copy/paste into an Access SQL query
window. Access will then tell you where the syntax error lies.

HTH,
-Mary
 
Hmmm... How do you do that?

Scott

Mary Chipman said:
You can debug Access SQL statements by using a variable and printing
the output, which you can then copy/paste into an Access SQL query
window. Access will then tell you where the syntax error lies.

HTH,
-Mary
 
Back
Top