473,782 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AdRotator Problem

MC
I have coded an AdRotator to use a Database for it's data source. If I
use a SqlDataSource control it functions as expected, however if I
manually retreive the data using an OleDBDataReader It always omits the
first item in the result set? Code for each solution as below.

The reason I'm don't want to use the Declarative solution is that I
intend to Create a custom control that inherits from AdRotator and I
would then need to retrieve the Advert set programtically.

Regards
MC

------------------- Solution 1 - Declarative -------------------

<asp:Content ID="Content2" ContentPlaceHol derID="cphMainS ite"
Runat="Server">
<asp:SqlDataSou rce ID="SqlDataSour ce1" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:AdsDatabase %>"
ProviderName="< %$ ConnectionStrin gs:AdsDatabase. ProviderName %>"
SelectCommand=" SELECT CompanyName AS ImageUrl, CompanyName AS
AlternateText, URL AS NavigateUrl, Impressions, Clicks FROM Sponsors
WHERE BannerAdvert=Tr ue" />
<asp:AdRotato r ID="AdRotator1 " runat="server"
DataSourceID="S qlDataSource1" />
</asp:Content>

------------------- Solution 2 - OleDBReader -------------------

<script runat="server">
protected void Page_Load(objec t sender, EventArgs e)
{
using (System.Data.Ol eDb.OleDbConnec tion conn = new
System.Data.Ole Db.OleDbConnect ion(Configurati onManager.Conne ctionStrings["AdsDatabas e"].ConnectionStri ng))
{
conn.Open();
using (System.Data.Ol eDb.OleDbComman d comm = new
System.Data.Ole Db.OleDbCommand ("SELECT CompanyName AS ImageUrl,
CompanyName AS AlternateText, URL AS NavigateUrl, Impressions, Clicks
FROM Sponsors WHERE BannerAdvert=Tr ue", conn))
{
AdRotator1.Data Source = comm.ExecuteRea der();
AdRotator1.Data Bind();
}
}
}
</script>
<asp:Content ID="Content2" ContentPlaceHol derID="cphMainS ite"
Runat="Server">
<asp:AdRotato r ID="AdRotator1 " runat="server" />
</asp:Content>
Oct 6 '07 #1
0 1578

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1626
by: kdmath | last post by:
I want to use the AdRotator control to dispay pay per click ads in the banner. I am able to use the AdRotator control for other links but when I use the code that the pay per click ads say to insert in to the page, the link code that tracks the clicks does not work. Surely there is a way to use this control for these ads. Any help would be apriciated. Thanks, kdmath
10
4880
by: Apostolis K. | last post by:
I include an AdRotator component but the component doesn't rotate the ads _index.asp_ <% Set objAd=Server.CreateObject("MSWC.AdRotator") vAdRotation=objAd.GetAdvertisement("ads.txt") Response.Write "<center>" & vAdRotation & "</center>" %> <html>
5
5595
by: Erica | last post by:
My images in Adrotator are not displaying. The ALT tag only displays. My text file looks like this: redirect redirect.asp border 0 height 115 width 215 * /images/awards.swf http://www.starone-intranet.com/main.asp
0
2566
by: Erica | last post by:
Hopefully someone can offer me a workaround to this problem: I am using adRotator to rotate some reminders on my intranet site. I have a redirect page name redirect.asp that recieves the querystring variable, 'url' and redirects the user to that page. One of the reminders should be redirected to a url that contains query strings itself. The url passes in the string up to the first '&'. What should I do. Here is the code on the page...
0
1256
by: Kiran R | last post by:
Hi, Is there any way to show different advertisements(images) in a certain interval of time using AdRotator. I am able to display different images when the page get refreshed using AdRotator. But...Is there any way to change the images without refreshing the page using AdRotator or by using any other controls?
1
1513
by: clintonG | last post by:
After months of stable operation the AdRotator has become unstable. Maybe its the Themes or the MasterPage who knows? The AdRotator is showing the images from Theme 1 when Theme 2 is selected and loaded. I have a very simple implementation... // Declared in MasterPage <div id="LogoCubes">
5
3124
by: Dan | last post by:
Hi, I created an AdRotator control with this code: <asp:AdRotator id="AdRotator1" Runat="Server" AdvertisementFile="adrotator.xml"> </asp:AdRotator> The xml file contains: <Advertisements> <Ad>
7
2490
by: Aussie Rules | last post by:
Hi, I have a adrotator control on a page, and want to program the connection of the control via SQL. I have the following code which doesn't seem to do much, and not sure what else to do? Dim SQLServerConnection As SqlConnection Dim SqlConnectionCls As New clsSQL
1
2958
by: Aussie Rules | last post by:
Hi, I have a few adrotators on a page, each bound to a sql dataset from my database The function works fine, but as we are going to charge for the advertising impression and click throughs I would like to be able to capture details about what add is displayed. The image name the adrotator is using would be good enough, but what would
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10146
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.