Note that there are some explanatory texts on larger screens.

plurals
  1. POApp is sending mm/dd/yyyy but SQL Server is expecting dd/mm/yyyy issue
    primarykey
    data
    text
    <p>I'm working on an old .NET 2.0 site that's having an issue with date searches.</p> <p>After a few hours of troubleshooting I've come to the conclusion that the search parameters being sent are in a <code>MM/DD/YYYY</code> format and SQL Server is expecting <code>DD/MM/YYYY</code></p> <p>I'm not sure how to fix this. </p> <p>I've tried converting it to string with ( <code>.ToString("dd/MM/yyyy")</code> ) then back to <code>DateTime</code>. This isn't working because it needs to be a nullable <code>DateTime</code></p> <blockquote> <p>CS1502: The best overloaded method match for 'TableAdapters.Artist_ListTableAdapter.GetData(int, System.DateTime?, System.DateTime?, int?, int?, bool?, string, string, string, int?, int?, int?, int?, int?, out int?)' has some invalid arguments</p> </blockquote> <p>Now I don't understand much about SQL Server stored procedures so I have no idea how to look at that <code>GetData</code> function... when I right click and go to definition I get a generated c# page.</p> <p>Any help?</p> <p>EDIT: @BigM Not sure if this will help but:</p> <p>Var declaration:</p> <pre><code>public DataTable dtArtist = new DataTable(); public string cp_basePath; public int pagecount; int CultureId ; DateTime? startDate; DateTime? endDate; int? disciplineId = null; int? minimumGradelevel = null; int? maximumGradelevel = null; int? languageId = null; bool? isFeatured = null; int? educationalInitiativeId = null; string EducationalInitiativeIds = string.Empty; string sortColumnName = string.Empty; string searchCriteria = string.Empty; </code></pre> <p>Grabbed from query string:</p> <pre><code>private void GetQueryStrings() { CultureId = objGeneralLayer.plCultureId; if (Request.QueryString["StartDate"] != null) startDate = Convert.ToDateTime(Request.QueryString["StartDate"].ToString(), CultureInfo.InvariantCulture); if (Request.QueryString["EndDate"] != null) endDate = Convert.ToDateTime(Request.QueryString["EndDate"].ToString(), CultureInfo.InvariantCulture); if (Request.QueryString["DisciplineId"] != null) disciplineId = Convert.ToInt32(Request.QueryString["DisciplineId"].ToString()); if (Request.QueryString["MinGrade"] != null) minimumGradelevel = Convert.ToInt32(Request.QueryString["MinGrade"].ToString()); if (Request.QueryString["MaxGrade"] != null) maximumGradelevel = Convert.ToInt32(Request.QueryString["MaxGrade"].ToString()); if (Request.QueryString["LanguageId"] != null) languageId = Convert.ToInt32(Request.QueryString["LanguageId"].ToString()); if (Request.QueryString["Featured"] != null) isFeatured = Convert.ToBoolean(Request.QueryString["Featured"].ToString()); if (Request.QueryString["EducatIds"] != null) EducationalInitiativeIds = Request.QueryString["EducatIds"].ToString(); if (Request.QueryString["Criteria"] != null) searchCriteria = Request.QueryString["Criteria"].ToString(); } </code></pre> <p>Then later on in the code:</p> <pre><code>dtArtist = objArtistLayer.getArtistList(CultureId,startDate, endDate, disciplineId, languageId, minimumGradelevel, maximumGradelevel, isFeatured, sortColumnName, searchCriteria, EducationalInitiativeIds, Stakeholder, currPage, pageSize, out rowCount); </code></pre> <p>Then later on:</p> <pre><code>public DataTable getArtistList( int CultureId , DateTime? StartDate ,DateTime? EndDate ,int? DisciplineId ,int? LanguageId ,int? MinimumGradeLevel ,int? MaximumGradeLevel ,bool? IsFeature ,string ColumnName ,string Criteria ,string EducationalInitiativeIds ,int ? StakeholderId ,int StartPage ,int PageSize ,out int RowCount ) { int? count = 0; StartDate = Convert.ToDateTime(StartDate); DataTable dt = new DataTable(); TableAdapters.Artist_ListTableAdapter ada = new TableAdapters.Artist_ListTableAdapter(); dt = ada.GetData(CultureId , StartDate , EndDate , MinimumGradeLevel , MaximumGradeLevel , IsFeature , ColumnName , Criteria , EducationalInitiativeIds , StakeholderId , DisciplineId , LanguageId , StartPage , PageSize , out count ); RowCount = (int)count; return dt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload