asp.net - My query works in Access, but not in Visual Studio -


this question exact duplicate of:

i have query have run in access doesn't seem run when execute on website site. here's code webpage want database populate content for:

    <asp:accessdatasource id="accessdatasource1" runat="server"                          datafile="~/app_data/traveljoansdb.accdb"                          selectcommand="select * [table2] inner join blogentryitems on table2.id=blogentryitems.blogid , table2.id=@id">                         <selectparameters>                             <asp:querystringparameter name="id" querystringfield="table2.id" type="decimal" />                                             </selectparameters>                         </asp:accessdatasource>      <asp:datalist id="datalist1" datasourceid="accessdatasource1"              runat="server" itemstyle-cssclass="pictablestyle"             datakeyfield="table.2id">             <itemstyle></itemstyle>             <itemtemplate>                 <table>                    <tr>                       <td>                          <asp:image id="image1" runat="server" imageurl='<%# "placeimages/" + eval("image") %>' /><br />                          <asp:label id="label1" cssclass="piccaptionstyle" runat="server" text='<%# eval("caption") %>' />                       </td>                    </tr>                    <tr>                       <td>                       <asp:label id="label4" class="picbodytext" runat="server" text='<%# eval("picstory") %>' />                       </td>                    </tr>                 </table>             </itemtemplate>      </asp:datalist> 

when take out join, works fine. add join , doesn't give me error or anything, seems though there no results show on website. ideas?

note haven't worked on accessdatasource. however, looking @ docs - here should into

  • change query use ? instead of @id
    selectcommand="select * [table2] inner join blogentryitems on table2.id=blogentryitems.blogid , table2.id= ?"

because accessdatasource control extends sqldatasource class , uses system.data.oledb provider, specify parameter placeholders using "?" placeholder character.

ref: http://msdn.microsoft.com/en-us/library/8e5545e1%28v=vs.100%29.aspx

  • if above doesn't work, omit data type (decimal) of parameter or specify relevant type such integer instead.

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo