Sunday, March 11, 2012

Data not displaying (in DataList) from SQL on GoDaddy

Everything works great on my development box. I am using GoDaddy for production (ASP.Net v2, SQL 2000).

I am not receiving any errors, so I am stumped; no data from the database is displaying on the GoDaddy pages.

I updated the connection string in web.config to this:

<addname="snsb"connectionString="

Server=whsql-vXX.prod.mesaX.secureserver.net;

Database=DB_42706;

User ID=username;

Password=pw;

Trusted_Connection=False

"providerName="System.Data.SqlClient" / >

But I am unsure if this is the issue?? Any insights? This is the page I am working on:www.sugarandspicebakery.com/demo/bakery/default.aspx. So, the page displays fine, but it should be showing data from the database. This particular page uses a DataList with ItemTemplate. There is definitely data in the database, and I have even ran the same exact query from the code using the Query Analayzer on GoDaddt and it returned results

I know there isn't much info to go by, but I am hoping someone has some insight since I have been trying to figure this out for days now!

Thank you

JenniferPost the code that you bind the datalist with the data source.
|||

Here is the code:

<asp:SqlDataSourceID="snsb"runat="server"ConnectionString="<%$ ConnectionStrings:snsb %>"SelectCommand="SELECT [itemNumber], [name], [shortDescription], [category], [imageFileName] FROM [snsb] WHERE ([category] = @.category)"EnableCaching="true"><SelectParameters><asp:QueryStringParameterDefaultValue="Cakes"Name="category"QueryStringField="cat"Type="String"/>
</SelectParameters></asp:SqlDataSource><asp:DataListID="DataList1"runat="server"RepeatColumns="3"RepeatDirection="Horizontal"CellPadding="25"AlternatingItemStyle-BorderWidth="1"DataSourceID="snsb"><ItemTemplate>

<asp:HyperLinkID="HyperLink1"runat="server"NavigateUrl='<%# "~/bakery/item.aspx?item=" + Eval("itemNumber") %>'>
<asp:Imagerunat="server"BorderColor="#000000"BorderStyle="solid"BorderWidth="1"ImageUrl='<%# "../images/page/" + Eval("itemNumber") + "_a.jpg" %>'Width="123"Height="82"/></asp:HyperLink><br/>
<%# Eval("name") %><br/>
<%# Eval("shortDescription") %>
</ItemTemplate></asp:DataList>

Sorry it looks all over the place here on the forum, the insert code option doesn't appear to be working correctly.

Thanks,

Jennifer

No comments:

Post a Comment