473,664 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adrotator

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 SQLServerConnec tion As SqlConnection
Dim SqlConnectionCl s As New clsSQL
SQLServerConnec tion = SqlConnectionCl s.Connect

Dim SqlCommand As New SqlCommand

With SqlCommand
.CommandType = Data.CommandTyp e.StoredProcedu re
.Connection = SQLServerConnec tion
.CommandTimeout = 15
.CommandText = "sproc_GetAddDe tails"
End With

Me.AdRotator1.D ataSource = SqlCommand

AdRotator1.Imag eUrlField = "advert_ima ge"
AdRotator1.Navi gateUrlField = "advert_URLlink "


Jun 4 '07 #1
7 2486
On Jun 4, 9:31 pm, "Aussie Rules" <AussieRu...@no spam.nospamwrot e:
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 SQLServerConnec tion As SqlConnection
Dim SqlConnectionCl s As New clsSQL
SQLServerConnec tion = SqlConnectionCl s.Connect

Dim SqlCommand As New SqlCommand

With SqlCommand
.CommandType = Data.CommandTyp e.StoredProcedu re
.Connection = SQLServerConnec tion
.CommandTimeout = 15
.CommandText = "sproc_GetAddDe tails"
End With

Me.AdRotator1.D ataSource = SqlCommand

AdRotator1.Imag eUrlField = "advert_ima ge"
AdRotator1.Navi gateUrlField = "advert_URLlink "
I think you forgot to get the data

AdRotator1.Data Source = SqlCommand.Exec uteReader

Jun 4 '07 #2
Hi Aussie,

As Alexey has suggested, for SqlCommand object, after you initialize it,
you can call the "ExecuteRea der" method (for select ) to return a
SqlDataReadere object. You can loop all the records in the resultset
through DataReader

#Retrieving Data Using a C# .NET DataReader
http://www.akadia.com/services/dotnet_data_reader.html

and for ASP.NET complex databound control, you can directly assign the
DataReader object to their "DataSource " property and call "DataBind" method
to perform databinding. e.g.

==============
SqlCommand comm;

..............
SqlDataReader reader = comm.ExecuteRea der();
AdRotator1.Data Source = reader;
AdRotator1.Data Bind();
=============== ====

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 5 '07 #3
Hi,

Thanks for your reply.

I am still not able to get this to work. My code is as follows. When I view
source of the HTML page, there are no values for the adrotator at all.
The Stored Proc works fine.

I can't see whats wrong......

Try

Dim SQLServerConnec tion As SqlConnection
Dim SqlConnectionCl s As New clsSQL
SQLServerConnec tion = SqlConnectionCl s.Connect
Dim SqlCommand As New SqlCommand

With SqlCommand

.CommandType = Data.CommandTyp e.StoredProcedu re
.Connection = SQLServerConnec tion
.CommandTimeout = 15
.CommandText = "sproc_GetBanne rAdvertDetails"

End With

' I have swapped these arround and tried, but not working. I have put the
image/navurl after the databind.

AdRotator1.Imag eUrlField = "advert_ima ge"
AdRotator1.Navi gateUrlField = "advert_URLlink "
AdRotator1.Data Source = SqlCommand.Exec uteReader
AdRotator1.Data Bind()

Catch ex As Exception
End Try


"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:84******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Aussie,

Regarding on this issue, I have also seen your another one in the
following
newsgroup:

Subject: Adrotator
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet

Community member Alexey and I have posted some suggestion there. Please
have a look and feel free to followup in that thread if you have any
further questions.

Thanks for your posting!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
"Alexey Smirnov" <al************ @gmail.comwrote in message
news:11******** *************@i 13g2000prf.goog legroups.com...
On Jun 4, 9:31 pm, "Aussie Rules" <AussieRu...@no spam.nospamwrot e:
>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 SQLServerConnec tion As SqlConnection
Dim SqlConnectionCl s As New clsSQL
SQLServerConnec tion = SqlConnectionCl s.Connect

Dim SqlCommand As New SqlCommand

With SqlCommand
.CommandType = Data.CommandTyp e.StoredProcedu re
.Connection = SQLServerConnec tion
.CommandTimeout = 15
.CommandText = "sproc_GetAddDe tails"
End With

Me.AdRotator1.D ataSource = SqlCommand

AdRotator1.Imag eUrlField = "advert_ima ge"
AdRotator1.Navi gateUrlField = "advert_URLlink "

I think you forgot to get the data

AdRotator1.Data Source = SqlCommand.Exec uteReader
Jun 5 '07 #4
On Jun 5, 7:26 pm, "Aussie Rules" <AussieRu...@no spam.nospamwrot e:
Hi,

Thanks for your reply.

I am still not able to get this to work. My code is as follows. When I view
source of the HTML page, there are no values for the adrotator at all.
The Stored Proc works fine.

I can't see whats wrong......
Aussie,

get rid of the try..catch block, I think you will see what is wrong.

Hope it helps

Jun 5 '07 #5
Hi,
Sorry I actually removed the catch code to save space. There was no error
created(catch never got fired)

Thanks

"Alexey Smirnov" <al************ @gmail.comwrote in message
news:11******** *************@p 77g2000hsh.goog legroups.com...
On Jun 5, 7:26 pm, "Aussie Rules" <AussieRu...@no spam.nospamwrot e:
>Hi,

Thanks for your reply.

I am still not able to get this to work. My code is as follows. When I
view
source of the HTML page, there are no values for the adrotator at all.
The Stored Proc works fine.

I can't see whats wrong......

Aussie,

get rid of the try..catch block, I think you will see what is wrong.

Hope it helps
Jun 6 '07 #6
On Jun 6, 8:40 am, "Aussie Rules" <AussieRu...@no spam.nospamwrot e:
Hi,
Sorry I actually removed the catch code to save space. There was no error
created(catch never got fired)

Thanks

"Alexey Smirnov" <alexey.smir... @gmail.comwrote in message

news:11******** *************@p 77g2000hsh.goog legroups.com...
On Jun 5, 7:26 pm, "Aussie Rules" <AussieRu...@no spam.nospamwrot e:
Hi,
Thanks for your reply.
I am still not able to get this to work. My code is as follows. When I
view
source of the HTML page, there are no values for the adrotator at all.
The Stored Proc works fine.
I can't see whats wrong......
Aussie,
get rid of the try..catch block, I think you will see what is wrong.
Hope it helps- Hide quoted text -

- Show quoted text -
Well, are you sure that sproc_GetBanner AdvertDetails is working? Try
to execute it in the Query Analizer (or any other tool to check the db
output)

Jun 6 '07 #7
Hi Aussie,

I'm not sure about your backend datasource. I suggest you perform the
following checK

1. Direclty bind the DataReader(get from SqlCommand) to a GridView (with
AutoGenerateCol umns="true") to verify whether the reader has returned the
correctly & expected resultset

2. For databinding code logic, here is the code in my local test page for
your reference:
=============== =============== ===
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load

BindRotator()

End Sub

Private Sub BindRotator()

Dim conn As SqlConnection
Dim comm As SqlCommand
Dim sql As String = "SELECT [id], [name], [description] FROM
[RVTable]"
Dim rdr As SqlDataReader
conn = New
SqlConnection(W ebConfiguration Manager.Connect ionStrings("ASP NETTestDBConnec t
ionString").Con nectionString)
conn.Open()
comm = New SqlCommand(sql, conn)

rdr = comm.ExecuteRea der()

AdRotator1.Data Source = rdr
AdRotator1.Imag eUrlField = "name"
AdRotator1.Navi gateUrlField = "descriptio n"

AdRotator1.Data Bind()

rdr.Close()

conn.Close()
End Sub
=============== =============== ==

If you have any further finding or question, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 6 '07 #8

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

Similar topics

0
1611
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
4802
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
5576
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
2552
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
1247
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
1501
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
3116
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>
1
2954
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
1571
by: MC | last post by:
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...
0
8348
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
8778
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...
0
8636
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...
0
7375
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
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
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4185
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...
0
4351
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1759
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.