Have been using this control for years using the XML file as the source for the ads. Was always a pain to add/remove ads so I decided to tap into structures I had in the db. Saw where you could use a pre-defined structure to pull the ads from the database
so I built a view that represented that structure. It displays the ads just fine now but it is ignoring the IMPRESSIONS field it seems. The columns in my view match the field names in the pre-defined structure. I see where ImageUrl and NavigateUrl have
properties that can be set on the control, but nothing there for Impressions. I have also seen some hints where the Impressions might not work when pulling from the DB. I've also seen some mention where it seems people are using this functionality with no
problem.
Just wanted to get a definitive word from somone as to whether Impressions work when pulling the ads from a database. I guess if I need to I can generate the XML file when needed.
Well it does works with both XML and when you store it in the DB.
Okay, that is good to hear. Impressions too?
Well, what would a scenario be where it (Impressions) would NOT work just because it is coming from the database? I am not pulling it from a table, instead it is coming from a view that I have created (had existing tables in place). Other
than the column names and uniqueness of the ID column, is there anything that must be in place for it to work? I guess I could try actually creating the physical table that matches the pre-defined structure exactly, including the PK on the ID?
I just don't understand why my view is working for the display of the Ads but NOT for the impressions.
Here is the structure of my view:
Column
Type
Length
Prec.
Scale
Nullable
Id.
Id. start
Id. seed
Row GUID
ID
int
4
10
0
True
False
False
ImageUrl
nvarchar
204
False
False
False
NavigateUrl
varchar
1000
False
False
False
AlternateText
varchar
50
False
False
False
Keyword
nvarchar
40
False
False
False
Impressions
smallint
2
5
0
False
False
False
Width
int
4
10
0
False
False
False
Height
int
4
10
0
False
False
False
** I do notice that it shows my ID field as being Nullable, even though there are no null values and they are unique
Here is my code for associating the AdRotator with the returned DataSet and DataBinding it. Nothing special:
Okay, so I did a quick switchover to an actual table that matches what MS prescribes in terms of structure. Proper data types, PK, column names, etc. I cranked the frequency of the banner rotation up and opened about 75 instances of a browser in order
to let these crank. After 30 minutes, it doesn't appear as if the Impressions weight is being used. The Ads that I have as a low weight (1) are displaying as often as those that I have with more weight (100). You would think, that even in a short period
of time, that the difference would be noticeable.
Could it be the way I am filling the datasource? I am doing it on PageLoad with a method that returns a dataset. Perhaps I should actually create a DataSource on the page and set the association that way? Then fill the DataSource in a more normal fashion.
I would just like for someone who has implemented this successfully, using different weights in the Impressions field, to tell me how they've done it.
Since I so often search these forums for answers I wanted to follow up with my own post and offer up a solution.
Since nobody here added anything of value, I continued Googling for a solution and found several other people facing the same problem. They weren't offered any answers either. It would appear that based on what I have seen, there is a problem with Impressions
when pulling the adds from a DataSource that is non-XML.
So, I found a post by someone who suggested pulling from the DB into an XML file then using that XML file as the source. After a little cleanup it works like a charm.
It would be nice not to have to take the extra step of creating the XML file, but with the standard approach not working as "advertised" [ :-) ] a guys got to do something.
First of all sorry i couldn't follow your query, i remember of using adrotator with databases and impression tag as well and it did work as far as i remember.
I did see it work in one of our projects, maybe the guys faced the same problem or maybe there is some other way out.
I'd just search for the project files and post in the code here, if it's different than the one you just found.
SteveInTN
Member
35 Points
49 Posts
AdRotator - Advertisements from Database
Oct 01, 2009 05:52 PM|LINK
Have been using this control for years using the XML file as the source for the ads. Was always a pain to add/remove ads so I decided to tap into structures I had in the db. Saw where you could use a pre-defined structure to pull the ads from the database so I built a view that represented that structure. It displays the ads just fine now but it is ignoring the IMPRESSIONS field it seems. The columns in my view match the field names in the pre-defined structure. I see where ImageUrl and NavigateUrl have properties that can be set on the control, but nothing there for Impressions. I have also seen some hints where the Impressions might not work when pulling from the DB. I've also seen some mention where it seems people are using this functionality with no problem.
Just wanted to get a definitive word from somone as to whether Impressions work when pulling the ads from a database. I guess if I need to I can generate the XML file when needed.
Thanks,
Steve
nijhawan.sau...
All-Star
16410 Points
3173 Posts
Re: AdRotator - Advertisements from Database
Oct 01, 2009 06:35 PM|LINK
Hi,
Well it does works with both XML and when you store it in the DB.
SteveInTN
Member
35 Points
49 Posts
Re: AdRotator - Advertisements from Database
Oct 01, 2009 07:50 PM|LINK
Okay, that is good to hear. Impressions too?
Well, what would a scenario be where it (Impressions) would NOT work just because it is coming from the database? I am not pulling it from a table, instead it is coming from a view that I have created (had existing tables in place). Other than the column names and uniqueness of the ID column, is there anything that must be in place for it to work? I guess I could try actually creating the physical table that matches the pre-defined structure exactly, including the PK on the ID?
I just don't understand why my view is working for the display of the Ads but NOT for the impressions.
Here is the structure of my view:
** I do notice that it shows my ID field as being Nullable, even though there are no null values and they are unique
Here is my code for associating the AdRotator with the returned DataSet and DataBinding it. Nothing special:
AdRotatorMain.DataSource = cdcDB.Banners.MainRotation();
AdRotatorMain.DataBind();
** cdcDB.Banners.MainRotation() method returns a DataSet
Should I be setting the "field" properties on the AdRotator even though my datasource/dataset matches the names?
Thanks for the help!
Steve
SteveInTN
Member
35 Points
49 Posts
Re: AdRotator - Advertisements from Database
Oct 01, 2009 08:33 PM|LINK
Here is the mention I found that there might be a problem with Impressions when pulling ads from the database:
http://bettereducation.com.au/it/yaf_postsm856_Database-table-field-Impressions-doesnt-work-in-ASPNET-20-AdRotator.aspx
Rather obscure mention I know, but makes me wonder.
In your implementations of this, did you use a physical table that matches the structure they prescribe?
Thanks,
Steve
SteveInTN
Member
35 Points
49 Posts
Re: AdRotator - Advertisements from Database
Oct 01, 2009 09:34 PM|LINK
Okay, so I did a quick switchover to an actual table that matches what MS prescribes in terms of structure. Proper data types, PK, column names, etc. I cranked the frequency of the banner rotation up and opened about 75 instances of a browser in order to let these crank. After 30 minutes, it doesn't appear as if the Impressions weight is being used. The Ads that I have as a low weight (1) are displaying as often as those that I have with more weight (100). You would think, that even in a short period of time, that the difference would be noticeable.
Could it be the way I am filling the datasource? I am doing it on PageLoad with a method that returns a dataset. Perhaps I should actually create a DataSource on the page and set the association that way? Then fill the DataSource in a more normal fashion.
I would just like for someone who has implemented this successfully, using different weights in the Impressions field, to tell me how they've done it.
Thanks,
Steve
SteveInTN
Member
35 Points
49 Posts
Re: AdRotator - Advertisements from Database
Oct 02, 2009 04:39 AM|LINK
Gonna bump this too...
SteveInTN
Member
35 Points
49 Posts
Re: AdRotator - Advertisements from Database
Oct 02, 2009 01:15 PM|LINK
Saurabh,
Could you please describe to me how you implemented and whether you used Impressions?
Thanks,
Steve
SteveInTN
Member
35 Points
49 Posts
Re: AdRotator - Advertisements from Database
Oct 03, 2009 04:38 PM|LINK
Since I so often search these forums for answers I wanted to follow up with my own post and offer up a solution.
Since nobody here added anything of value, I continued Googling for a solution and found several other people facing the same problem. They weren't offered any answers either. It would appear that based on what I have seen, there is a problem with Impressions when pulling the adds from a DataSource that is non-XML.
So, I found a post by someone who suggested pulling from the DB into an XML file then using that XML file as the source. After a little cleanup it works like a charm.
http://www.dotnetspider.com/resources/17193-Dynamic-XML-file-for-AdRotator-through-database.aspx
It would be nice not to have to take the extra step of creating the XML file, but with the standard approach not working as "advertised" [ :-) ] a guys got to do something.
nijhawan.sau...
All-Star
16410 Points
3173 Posts
Re: AdRotator - Advertisements from Database
Oct 03, 2009 05:04 PM|LINK
Hi Steve,
First of all sorry i couldn't follow your query, i remember of using adrotator with databases and impression tag as well and it did work as far as i remember.
I did see it work in one of our projects, maybe the guys faced the same problem or maybe there is some other way out.
I'd just search for the project files and post in the code here, if it's different than the one you just found.
Thank You!
SteveInTN
Member
35 Points
49 Posts
Re: AdRotator - Advertisements from Database
Oct 04, 2009 04:22 AM|LINK
Saurabh,
That would be fantastic. Thanks much!
I tried everything I could think of, including precisely by the "book" on db structure and code.
Steve