Error exporting orders

Posted By Supermac Tue 4 Aug 2015
Add to Favorites0
Author Message
Supermac
 Posted Tue 4 Aug 2015
Supreme Being

Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)

Group: Forum Members
Last Active: Wed 22 Jul 2020
Posts: 153, Visits: 874
When I try to export orders in csv format I obtain this error log... It talks about a conversion error from string to date, but wich date should I check/modify?
Setting start and end date in extraction's parameters form I see date in yyyy/MM/dd format...
I think the second error is son of first one so I wish second will disappear fixing the first.
Thank you

-----------------------------------------------------------------------------
>> ExportBLL._ExportOrders
-----------------------------------------------------------------------------
>> System.Data.SqlClient.SqlException
>> 04/08/2015 16:51:55
>> Version:2,8004
>> URL:http://myweb/Admin/_DBAdmin.aspx
>> CUSTOM MESSAGE:
Errore del database: un errore generale si è verificato.
>> NUMBER:241
>> MESSAGE:
Conversione non riuscita durante la conversione di una stringa di caratteri in una data o ora.
>> STACK:
in System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
in System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
in System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
in System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
in System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
in System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
in System.Data.SqlClient.SqlDataReader.Read()
in System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
in System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
in System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
in System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
in System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
in System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
in ExportBLL._ExportOrders(String strDateFrom, String strDateTo, Boolean blnIncludeDetails, Boolean blnIncompleteOrders)
==================================================

-----------------------------------------------------------------------------
>> Version:2,8004
>> URL:http://myweb/Admin/_DBAdmin.aspx
>> Page:
-----------------------------------------------------------------------------
>> 04/08/2015 16:51:55
>> DESCRIPTION:
System.NullReferenceException: Riferimento a un oggetto non impostato su un'istanza di oggetto.
in CKartrisCSVExporter.WriteToCSV(DataTable tblToExport, String strFileName, Int32 intFieldDelimiter, Int32 intStringDelimiter)
in UserControls_Back_AdminExportData.btnExportOrders_Click(Object sender, EventArgs e)
in System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)
in System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
in System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
in System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
in System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
in System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

==================================================
Supermac Marked As Answer
 Posted Wed 5 Aug 2015
Supreme Being

Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)Supreme Being - (84,805 reputation)

Group: Forum Members
Last Active: Wed 22 Jul 2020
Posts: 153, Visits: 874
Well, solved.
Problem was in _AdminExportData.ascx.vb.

It calls
ExportBLL._ExportOrders(strStartDate, strEndDate, chkOrderDetails.Checked, chkIncompleteOrders.Checked)
but giving strStartDate and strEndDate parameters in a format that _spKartrisDB_ExportOrders stored procedure (called by ExportBLL._ExportOrders) doesn't accept.

To make it work I had to comment
strStartDate = MonthName(CDate(txtStartDate.Text).Month, True) & " " & CDate(txtStartDate.Text).Day & " " & CDate(txtStartDate.Text).Year
having that stored procedure was unable to cast it as datetime, and rewrite it as
strStartDate = Cdate(txtStartDate.Text).toString("dd/MM/yyyy")
in _AdminExportData.ascx (the same for strEndDate parameter)

Don't know if this is a bug, it may depends on language versions of SQL, however I report it.
Wed 5 Aug 2015 by Supermac

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top