Error in Search.aspx.vb after adding date columns in databasehttp://forums.asp.net/t/1520992.aspx/1?Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseThu, 26 Aug 2010 04:12:57 -040015209923655083http://forums.asp.net/p/1520992/3655083.aspx/1?Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseError in Search.aspx.vb after adding date columns in database <p>&nbsp;I've added two date&nbsp;columns (as datetime, nullable) to the ads database and updated Ads.vb, Ads.xds, PostAds but I'm getting the following error on Search.aspx.vb</p> <p><b>Exception Details: </b>System.InvalidOperationException: ObjectDataSource 'AdSearchDataSource' could not find a non-generic method 'GetActiveAdsByQuery' that has parameters: recordLimit, categoryId, memberId, maxPrice, searchTerm, location, adType, adLevel, dayRange, mustHaveImage, city.<br> <br> <b>Source Error:</b> <br> <br> </p> <table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td><pre class="prettyprint"><pre>Line 786: BrowsePanel.Visible = False</pre> Line 787: ResultsPanel.Visible = True Line 788: ResultsPanel.DataBind() Line 789: Else Line 790: ' if no search critieria were specified, show the regular browse category view (as on Default.aspx) <pre></pre> If (AdvancedSearch.AdType &lt;&gt; 0) Then sb.Append(&quot;ad type = &quot;&quot;&quot; &amp; CType(AdvancedSearch.AdType, AdType) &amp; &quot;&quot;&quot; &lt;br/&gt;&quot;) End If If (AdvancedSearch.MustHavePhotos) Then sb.Append(&quot;photo = &quot;&quot;&quot; &amp; AdvancedSearch.MustHavePhotos &amp; &quot;&quot;&quot; &lt;br/&gt;&quot;) End If If (AdvancedSearch.City.Length &gt; 0) Then sb.Append(&quot;city = &quot;&quot;&quot; &amp; Server.HtmlEncode(AdvancedSearch.City) &amp; &quot;&quot;&quot; &lt;br/&gt;&quot;) End If</pre><PRE>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;Seems like there should be some reference to eventStart and eventEnd here&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;</PRE><PRE>&nbsp;</PRE><PRE>Does anyone know if this is the problem and if so, what goes in here? Or, maybe I'm looking in the wrong </PRE><PRE>place altogether. Would really appreciate any help. My site is up but search isn't working at all. Thanks.<BR></PRE></pre></td> </tr> </tbody> </table> 2010-02-02T10:29:12-05:003655364http://forums.asp.net/p/1520992/3655364.aspx/1?Re+Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseRe: Error in Search.aspx.vb after adding date columns in database <p>It looks like 'GetActiveAdsByQuery' SP doesn't have the correct number of parameters.&nbsp; Check your SP again to ensure it matches the object datasource 'AdSearchDataSource' or visa versa.&nbsp;</p> 2010-02-02T12:31:24-05:003656631http://forums.asp.net/p/1520992/3656631.aspx/1?Re+Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseRe: Error in Search.aspx.vb after adding date columns in database <p>My stored procedure is </p> <p>USE [pgclassifieds1]<br> GO</p> <p>/****** Object:&nbsp; StoredProcedure [dbo].[GetAllAdsByQuery]&nbsp;&nbsp;&nbsp; Script Date: 02/02/2010 16:43:30 ******/<br> SET ANSI_NULLS OFF<br> GO</p> <p>SET QUOTED_IDENTIFIER ON<br> GO</p> <p><br> ALTER PROCEDURE GetAllAdsByQuery<br> @LimitResultCount int = 50,<br> @CategoryId int = 0,<br> @MemberId int = 0,<br> @MaxPrice money = -1,<br> @SearchTerm nvarchar(50) = N'',<br> @Location nvarchar(50) = N'',<br> @AdType int = 0,<br> @AdStatus int = 0,<br> @AdLevel int = 0,<br> @MinDateCreated smalldatetime = NULL,<br> @MustHaveImage bit = false,<br> @City nvarchar(50) = N'',<br> @EventStart datetime = NULL,<br> @EventEnd datetime = NULL</p> <p>AS<br> &nbsp;SET ROWCOUNT @LimitResultCount</p> <p>&nbsp;SELECT *<br> &nbsp;FROM ClassifiedsView_Ads<br> &nbsp;WHERE<br> &nbsp;(@CategoryId = 0 OR <br> &nbsp;CategoryId IN (<br> &nbsp;SELECT Id FROM classifieds_Categories<br> &nbsp;WHERE Path LIKE<br> &nbsp;&nbsp; (SELECT Path<br> &nbsp;&nbsp;&nbsp; FROM classifieds_Categories<br> &nbsp;&nbsp;&nbsp; WHERE Id = @CategoryId ) &#43; '%'<br> &nbsp;)) AND <br> &nbsp;(@MaxPrice = -1 OR Price &lt;= @MaxPrice) AND<br> &nbsp;(@MustHaveImage = 0 OR PreviewImageId IS NOT NULL) AND<br> &nbsp;(@AdStatus = 0 OR AdStatus = @AdStatus) AND<br> &nbsp;(@AdLevel = 0 OR AdLevel = @AdLevel) AND<br> &nbsp;(@AdType = 0 OR AdType = @AdType) AND <br> &nbsp;(@MemberId = 0 OR MemberId = @MemberId) AND <br> &nbsp;(@MinDateCreated IS NULL OR DateCreated &gt; @MinDateCreated) AND<br> &nbsp;Title LIKE '%' &#43; @SearchTerm &#43; '%' AND <br> &nbsp;Location LIKE '%' &#43; @Location &#43; '%' AND<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; City LIKE '%' &#43; @City &#43; '%' AND<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (@EventStart = -1 OR EventStart = @EventStart) AND<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (@EventEnd = -1 OR EventEnd = @EventEnd)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p> <p>&nbsp;&nbsp;&nbsp; ORDER BY DateCreated DESC<br> &nbsp;&nbsp;&nbsp; <br> &nbsp;SET ROWCOUNT 0</p> <p>GO</p> <p>There is no stored procedure for GetActiveAdsByQuery that I can find.&nbsp; Ads.vb does have a section called GetActiveAdsByQuery that matches the xsd section for GetAllAdsByQuery.&nbsp; There's no GetActiveAdsByQuery in this file either.&nbsp; </p> <p>I added a field before and had a similar problem, but could this be different because I'm adding DateTime fields?&nbsp; Thanks</p> <p>Thanks, Bev</p> 2010-02-02T22:57:30-05:003656893http://forums.asp.net/p/1520992/3656893.aspx/1?Re+Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseRe: Error in Search.aspx.vb after adding date columns in database <p>Then check this datasource 'AdSearchDataSource' and see how it is configured or post the code for that datasource.&nbsp;</p> 2010-02-03T02:56:06-05:003657663http://forums.asp.net/p/1520992/3657663.aspx/1?Re+Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseRe: Error in Search.aspx.vb after adding date columns in database <p>I found the GetActiveAdsByQuery in Ads.vb was missing adStatus.&nbsp; I don't know why.&nbsp; It's not something I've messed with.&nbsp; Anyhow, I put it back in and looks like I'm past&nbsp;the line of code that was causing the original problem.&nbsp; Here's the new error</p> <pre class="prettyprint">Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30456: 'Activated' is not a member of 'Integer'. Source Error: Line 157: HttpUtility.HtmlEncode(escapedSearchTerm), _ Line 158: HttpUtility.HtmlEncode(escapedLocation), _ Line 159: adType, CInt(AdStatus.Activated), _ Line 160: adLevel, dayRange, mustHaveImage, city, eventStart, eventEnd) Line 161: Source File: XXX:\XXXXX\XXXXXX\App_Code\BLL\Ads.vb Line: 159</pre><pre class="prettyprint">#Region "GetAds..." Public Shared Function GetAdById(ByVal adId As Integer) As AdsDataComponent.AdsRow Using db As New AdsDataAdapter() Return GetFirstRow(db.GetAdById(adId)) End Using End Function Public Shared Function GetActiveAdsByQuery(ByVal recordLimit As Integer, ByVal categoryId As Integer, ByVal memberId As Integer, ByVal maxPrice As Decimal, ByVal searchTerm As String, ByVal location As String, ByVal adType As Integer, ByVal adStatus As CInt, ByVal adLevel As Integer, ByVal dayRange As Integer, ByVal mustHaveImage As Boolean, ByVal city As String, ByVal eventStart As Date, ByVal eventEnd As Date) As AdsDataComponent.AdsDataTable Dim escapedSearchTerm As String = AdsDB.EscapeWildcardCharacters(searchTerm) Dim escapedLocation As String = AdsDB.EscapeWildcardCharacters(location) Return GetAdsByQuery(recordLimit, _ categoryId, memberId, maxPrice, _ HttpUtility.HtmlEncode(escapedSearchTerm), _ HttpUtility.HtmlEncode(escapedLocation), _ adType, CInt(AdStatus.Activated), _ adLevel, dayRange, mustHaveImage, city, eventStart, eventEnd) End Function Public Shared Function GetAdsByQuery(ByVal recordLimit As Integer, ByVal categoryId As Integer, ByVal memberId As Integer, ByVal maxPrice As Decimal, ByVal searchTerm As String, ByVal location As String, ByVal adType As Integer, ByVal adStatus As Integer, ByVal adLevel As Integer, ByVal dayRange As Integer, ByVal mustHaveImage As Boolean, ByVal city As String, ByVal eventStart As Date, ByVal eventEnd As Date) As AdsDataComponent.AdsDataTable Dim minCreatedDate As System.Nullable(Of DateTime) If location Is Nothing Then location = "" End If If city Is Nothing Then city = "" End If If dayRange &gt; 0 Then minCreatedDate = DateTime.Now.Subtract(TimeSpan.FromDays(dayRange)) End If ' To return no results if the searchTerm is empty remove the following ' check on the searchTerm. If searchTerm Is Nothing Then searchTerm = "" End If Using db As New AdsDataAdapter() Dim aa As AdsDataComponent.AdsDataTable = Nothing aa = db.GetAllAdsByQuery(recordLimit, categoryId, memberId, maxPrice, searchTerm, location, adType, adStatus, adLevel, minCreatedDate, mustHaveImage, city, eventStart, eventEnd) Return aa End Using End Function Public Shared Function GetPendingAds() As AdsDataComponent.AdsDataTable Return GetAdsByStatus(AdStatus.ActivationPending, DefaultValues.IdNullValue) End Function Public Shared Function GetPendingAds(ByVal memberId As Integer) As AdsDataComponent.AdsDataTable Return GetAdsByStatus(AdStatus.ActivationPending, memberId) End Function Public Shared Function GetActiveAds(ByVal memberId As Integer) As AdsDataComponent.AdsDataTable Return GetAdsByStatus(AdStatus.Activated, memberId) End Function Public Shared Function GetInactiveAds(ByVal memberId As Integer) As AdsDataComponent.AdsDataTable Return GetAdsByStatus(AdStatus.Inactive, memberId) End Function 'GetInactiveAds Public Shared Function GetAdsByStatus(ByVal adStatus As AdStatus, ByVal memberId As Integer) As AdsDataComponent.AdsDataTable Using db As New AdsDataAdapter() Return db.GetAdsByStatus(CInt(adStatus), memberId) End Using End Function Public Shared Function GetAdsByStatus(ByVal adStatus As AdStatus) As AdsDataComponent.AdsDataTable Return GetAdsByStatus(adStatus, DefaultValues.IdNullValue) End Function Public Shared Function GetFeaturedAdsSelection(ByVal maxNumAds As Integer) As AdsDataComponent.AdsDataTable If maxNumAds &lt; 1 Then Return Nothing End If Using db As New AdsDataAdapter() Return db.GetAdsByRandomOrder(maxNumAds, CInt(AdStatus.Activated), CInt(AdLevel.Featured)) End Using End Function Public Shared Function GetSavedAds(ByVal memberId As Integer) As AdsDataComponent.AdsDataTable Using db As New AdsDataAdapter() Return db.GetSavedAds(memberId) End Using End Function #End Region</pre><pre class="prettyprint"> </pre> <p><br> &nbsp;</p> 2010-02-03T08:59:24-05:003658866http://forums.asp.net/p/1520992/3658866.aspx/1?Re+Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseRe: Error in Search.aspx.vb after adding date columns in database <p>I've double and triple checked my database tables, stored procedures, Ads.xsd file and Ads.aspx.vb and can't find anywhere the column order doesn't match.&nbsp; Search doesn't work.&nbsp; I get the following error.&nbsp; But MyAds does return the correct ads, columns in</p> <p><b>Exception Details: </b>System.InvalidOperationException: ObjectDataSource 'AdSearchDataSource' could not find a non-generic method 'GetActiveAdsByQuery' that has parameters: recordLimit, categoryId, memberId, maxPrice, searchTerm, location, adType, adLevel, dayRange, mustHaveImage, city.<br> <br> <b>Source Error:</b> <br> <br> </p> <table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td><pre class="prettyprint"><pre>Line 234: BrowsePanel.Visible = False</pre> Line 235: ResultsPanel.Visible = True Line 236: ResultsPanel.DataBind() Line 237: Else Line 238: ' if no search critieria were specified, show the regular browse category view (as on Default.aspx) <pre></pre> <pre> </pre> <pre>The AdSearchDataSource is in Search.aspx.vb</pre> <pre></pre> <p>' copy the values which the AdSearchDataSource needs on this page (SearchTerm comes from SearchTermTextBox, Category comes from the CategoryDropDown control)</p> <p>SetCurrentCategory(AdvancedSearch.CategoryId)</p> <p>SearchTermTextBox.Text = AdvancedSearch.SearchTerm</p> <p>There's no reference to AdSearchDataSource outside of Search.aspx.vb that I can find. Can anyone help point me in the right direction, please?</p> <pre></pre></pre></td> </tr> </tbody> </table> 2010-02-03T19:35:59-05:003658929http://forums.asp.net/p/1520992/3658929.aspx/1?Re+Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseRe: Error in Search.aspx.vb after adding date columns in database <p>The problem lies with this&nbsp;function:</p> <pre class="prettyprint"><p><br> This function has 14 required parameters and the error you receive:</p> ... GetActiveAdsByQuery that has parameters: recordLimit, categoryId, memberId, maxPrice, searchTerm, location, adType, adLevel, dayRange, mustHaveImage, city.</pre> <p><br> Only has 11 parameters.&nbsp; So you need to modify where this is called to include those parameters.</p> <p>What I would do is a Ctrl&#43;F (search) the whole project for GetActiveAdsByQuery.&nbsp; This should show you where all the times you call that function.&nbsp; You could also try debugging and placing a breakpoint on the databind&nbsp;line where you receive the error.&nbsp; This will allow you to step into the databinding event and see if GetActiveAdsByQuery is called and where.</p> 2010-02-03T20:09:54-05:003659087http://forums.asp.net/p/1520992/3659087.aspx/1?Re+Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseRe: Error in Search.aspx.vb after adding date columns in database <p>I'm not&nbsp;certain, but I seem to have got by that error.&nbsp; Now I'm&nbsp;getting the following and the site won't load.&nbsp; Not sure if I've fixed anything, or simply added another layer of error.&nbsp; The database does not have a GetActiveAdsByQuery stored procedure and the Ads.xsd doesn't either.&nbsp; Still the search function worked ok before I add the two fields so I don't think that is part of the problem.</p> <p>There are two references to GetActiveAdsByQuery in the site.&nbsp; 1 is the Search.aspx page</p> <p>&lt;!-- uc1:AdvancedSearch (invisible) is used to handle parameters for AdSearchDataSource --&gt;<br> &nbsp;&lt;uc1:AdvancedSearch ID=&quot;AdvancedSearch&quot; runat=&quot;server&quot; Visible=&quot;False&quot;&gt;&lt;/uc1:AdvancedSearch&gt;<br> &nbsp;&lt;asp:ObjectDataSource ID=&quot;AdSearchDataSource&quot; runat=&quot;server&quot; TypeName=&quot;AspNet.StarterKits.Classifieds.BusinessLogicLayer.AdsDB&quot;<br> &nbsp;&nbsp;SelectMethod=&quot;GetActiveAdsByQuery&quot;&gt;<br> &nbsp;&nbsp;&lt;SelectParameters&gt;<br> &nbsp;&nbsp;&nbsp;&lt;asp:Parameter Type=&quot;Int32&quot; DefaultValue=&quot;5000&quot; Name=&quot;recordLimit&quot;&gt;&lt;/asp:Parameter&gt;<br> &nbsp;&nbsp;&nbsp;&lt;asp:ControlParameter Name=&quot;categoryId&quot; DefaultValue=&quot;0&quot; Type=&quot;Int32&quot; ControlID=&quot;CategoryDropDown&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;PropertyName=&quot;CurrentCategoryId&quot;&gt;&lt;/asp:ControlParameter&gt;<br> &nbsp;&nbsp;&nbsp;&lt;asp:ControlParameter Name=&quot;memberId&quot; ControlID=&quot;AdvancedSearch&quot; PropertyName=&quot;MemberId&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;Type=&quot;Int32&quot; DefaultValue=&quot;0&quot; /&gt;<br> &nbsp;&nbsp;&nbsp;&lt;asp:ControlParameter Name=&quot;maxPrice&quot; ControlID=&quot;AdvancedSearch&quot; PropertyName=&quot;MaximumPrice&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;Type=&quot;Decimal&quot; DefaultValue=&quot;-1&quot; /&gt;<br> &nbsp;&nbsp;&nbsp;&lt;asp:ControlParameter Name=&quot;searchTerm&quot; DefaultValue=&quot;&quot; Type=&quot;String&quot; ControlID=&quot;SearchTermTextBox&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;PropertyName=&quot;Text&quot;&gt;&lt;/asp:ControlParameter&gt;<br> &nbsp;&nbsp;&nbsp;&lt;asp:ControlParameter Name=&quot;location&quot; ControlID=&quot;AdvancedSearch&quot; PropertyName=&quot;Location&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;Type=&quot;String&quot; DefaultValue=&quot;&quot; /&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br> &nbsp;&nbsp;&nbsp;&lt;asp:ControlParameter Name=&quot;adType&quot; ControlID=&quot;AdvancedSearch&quot; PropertyName=&quot;AdType&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;Type=&quot;Int32&quot; DefaultValue=&quot;0&quot; /&gt;<br> &nbsp;&nbsp;&nbsp;&lt;asp:Parameter Type=&quot;Int32&quot; DefaultValue=&quot;0&quot; Name=&quot;adLevel&quot;&gt;&lt;/asp:Parameter&gt;<br> &nbsp;&nbsp;&nbsp;&lt;asp:ControlParameter Name=&quot;dayRange&quot; ControlID=&quot;AdvancedSearch&quot; PropertyName=&quot;DayRange&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;Type=&quot;Int32&quot; DefaultValue=&quot;-1&quot; /&gt;<br> &nbsp;&nbsp;&nbsp;&lt;asp:ControlParameter Name=&quot;mustHaveImage&quot; ControlID=&quot;AdvancedSearch&quot; PropertyName=&quot;MustHavePhotos&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;Type=&quot;Boolean&quot; DefaultValue=&quot;False&quot; /&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:ControlParameter Name=&quot;city&quot; ControlID=&quot;AdvancedSearch&quot; PropertyName=&quot;City&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Type=&quot;String&quot; DefaultValue=&quot;&quot; /&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:ControlParameter Name=&quot;eventStart&quot; ControlID=&quot;AdvancedSearch&quot; PropertyName=&quot;EventStart&quot;&nbsp;</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Type=&quot;DateTime&quot; DefaultValue=&quot;NULL&quot; /&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:ControlParameter Name=&quot;eventEnd&quot; ControlID=&quot;AdvancedSearch&quot; PropertyName=&quot;EventEnd&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Type=&quot;DateTime&quot; DefaultValue=&quot;NULL&quot; /&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/SelectParameters&gt;<br> &nbsp;&lt;/asp:ObjectDataSource&gt;<br> </p> <p>*******When I added EventStart and EventEnd the original error&nbsp; went away and now I'm&nbsp;getting the following error.&nbsp; The only other reference is in Ads.vb<br> </p> <p><b>Compiler Error Message: </b>BC30456: 'EventStart' is not a member of 'AdvancedSearch_ascx'.<br> <br> <b>Source Error:</b><br> <br> <table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td></td> </tr> <tr> <td></td> </tr> </tbody> </table> </p> <p><br> Line 189:&nbsp;&nbsp;&nbsp; Public Sub SetEventStart(ByVal eventStart As Date)<br> Line 190:<br> <font color="red">Line 191:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Me.EventStart = eventStart<br> </font>Line 192:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim EventStartDate As Date = Me.EventStart<br> Line 193:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If Not (EventStartDate &gt; 0) Then<br> <b>Source File:</b> d:\hosting\rporterpg\Controls\AdvancedSearch.ascx.vb &nbsp;&nbsp; <b>Line:</b> 191&nbsp;</p> <p>I've tried to copy the code for another column to add EventStart, but it's not correct apparently.&nbsp; I keep thinking if I was making a string rather than a date I could just copy the way city is coded.&nbsp; Not sure if that has anything to do with the problem.</p> <p>Thanks for your reply.&nbsp; </p> 2010-02-03T21:43:42-05:003665689http://forums.asp.net/p/1520992/3665689.aspx/1?Re+Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseRe: Error in Search.aspx.vb after adding date columns in database <p>In case anyone&nbsp;else is working&nbsp;this sort of problem.&nbsp; My solution (cop out maybe) was to start over&nbsp;and add the fields as integers.&nbsp; So&nbsp;instead of StartDate and EndDate, I have StartYear, StartMonth, StartDate and EndMonth, EndDate.&nbsp; As integers I was able to copy an existing field, AdType and make the thing work.</p> <p>One thing I learned...dates are different.&nbsp;</p> 2010-02-07T22:24:11-05:003665748http://forums.asp.net/p/1520992/3665748.aspx/1?Re+Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseRe: Error in Search.aspx.vb after adding date columns in database <p>It sounds to me as if it was a data type problem now.&nbsp;&nbsp;</p> <p>If these dates are needed later for anything&nbsp;other t han you are using them for,&nbsp;you will regret having the date separated like that.&nbsp; &nbsp;</p> 2010-02-08T00:11:11-05:003668033http://forums.asp.net/p/1520992/3668033.aspx/1?Re+Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseRe: Error in Search.aspx.vb after adding date columns in database <p>Hi. Yes, I think it is a data type problem.&nbsp; I just don't have the experience to&nbsp;replicate the various bits of code to deal&nbsp;with dates.&nbsp; There are dates in the classified starter kits, but they are all calculated dates.&nbsp; None is a direct user input date which is what I was trying to do.</p> <p>I know I may regret my &quot;cop out&quot; later.&nbsp; However, the purpose of the dates is only for sorting/searching and I'm hopeful I'll be able to use the separate fields as integers for that purpose.&nbsp; In any event, I just ran out of time.&nbsp; My website was effectively off the air for over a week and I had&nbsp;to get it back somehow.&nbsp; </p> <p>Thanks again for your help.&nbsp;&nbsp;Even when I don't entirely understand the answer, it is so helpful to know there is somewhere I can go to ask.&nbsp;&nbsp;&nbsp;</p> 2010-02-09T02:33:46-05:004046182http://forums.asp.net/p/1520992/4046182.aspx/1?Re+Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseRe: Error in Search.aspx.vb after adding date columns in database <p>Go into the database and check the Views - which is where the search function is going against.&nbsp; You'll have to add the two date columns to the View definition.</p> <p>&nbsp;</p> <p>Regards,</p> <p>Scott&nbsp;</p> 2010-08-26T03:41:08-04:004046216http://forums.asp.net/p/1520992/4046216.aspx/1?Re+Error+in+Search+aspx+vb+after+adding+date+columns+in+databaseRe: Error in Search.aspx.vb after adding date columns in database <p>Bev, it's not a datatype problem, just a user problem ;)&nbsp;&nbsp; After you add the extra columns to GetActiveAdsByQuery(), you'll have to add the sameto GetAdsByQuery(),and GetAllAdsByQuery() in your code (the Ads.cs) file. You'll then have to load the Ads Adapter in the Designer and locate the GetAllAdsByQuery method and add the extra parameters to the call using the Parameter Collections Editor. Next to last, you'll have to add them to the stored procedure GetAllAdsQuery.&nbsp; Finally - and this is most likely why your search is crashing, the sp is SELECTing from a View&nbsp; classifiedsView_Ads , which means you'll have to alter the View's definition to add the two date columns in the SELECT statement so that they shouw up in the result set for the procedure to use. Tha's why you're not finding anything (bcs the View is the missing link here). Since they aren't there to begin with, the application is having a fit because it can't reconcile two variable you added with anything it's getting back from the database. I know it's sounds complicate and overwhelming, but take it step by step, trace your program call from Search-&gt;Ads-&gt;Ads.xsd-&gt;StoredProc-&gt;View-&gt;StoredProc-&gt;ObjectDataSource(ie, Ads.xsd)-&gt;Ads-&gt;Search.</p> <p>Take a look at the MinDateCreated columns to see how the application is going about using dates. You can use the same logic for you Start/End dates conditions.</p> <p>Also, try to not to modify ads.xsd by handle unless you know exactly what you're doing. Work with that file with the appropriate designer, it'll result in fewer headaches down the road.</p> <p>Regards,</p> <p>Scott</p> 2010-08-26T04:12:57-04:00