Help - Search - Members - Calendar
Full Version: Failed to convert parameter
Fast Reports forum > Fast Reports Products > FastReport .NET
waynepangXXX
I received this error message when i try to use dataselector to pass parameter to sql function... sad.gif ph34r.gif




FastReport.Net v1.3.25
Failed to convert parameter value from a String[] to a String.
Inner exception:
Object must implement IConvertible.
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)
at System.Data.SqlClient.SqlParameter.CoerceValue(Object value, MetaType destinationType)
at System.Data.SqlClient.SqlParameter.GetCoercedValue()
at System.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc)
at System.Data.SqlClient.SqlCommand.BuildParamList(TdsParser parser, SqlParameterCollection parameters)
at System.Data.SqlClient.SqlCommand.BuildExecuteSql(CommandBehavior behavior, String commandText, SqlParameterCollection parameters, _SqlRPC& rpc)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavio
r behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at FastReport.Data.DataConnectionBase.FillTableData(DataTable table, String selectCommand, CommandParameterCollection parameters)
at FastReport.Data.DataConnectionBase.FillTable(TableDataSource source)
at FastReport.Data.TableDataSource.LoadData(ArrayList rows)
at FastReport.Data.DataSourceBase.xhRusQrvC()
at FastReport.Data.DataSourceBase.Init(Relation relation, String filter, SortCollection sort)
at FastReport.Data.DataSourceBase.Init(DataSourceBase parentData, String filter, SortCollection sort)
at FastReport.DataBand.InitDataSource()
at FastReport.GroupHeaderBand.JpXNscdbD()
at FastReport.Engine.ReportEngine.O9MBQ6Cab(GroupHeaderBand )
at FastReport.Engine.ReportEngine.cYGNCD6VBn(BandCollection )
at FastReport.Engine.ReportEngine.0o7NSxJGS3(ReportPage )
at FastReport.Engine.ReportEngine.i73Nip9s4d()
at FastReport.Engine.ReportEngine.ETbCChjds(ReportPage )
at FastReport.Engine.ReportEngine.j5trlWRx0(Boolean , Boolean , ReportPage )
at FastReport.Engine.ReportEngine.gqwMraMKx(Boolean , Boolean )
at FastReport.Report.Prepare(Boolean append)
at FastReport.Report.Prepare()
at plVQu6DlA1kWEugkKuY.9n4jBkD1hZrXBD9AwUv.T5oiHycTE()
AlexTZ
Sql parameter can take single value only. You are trying to pass an array of string values, this is not correct.
waynepangXXX
QUOTE(AlexTZ @ Feb 10 2010, 01:13 AM) *
Sql parameter can take single value only. You are trying to pass an array of string values, this is not correct.


It is posible if i want to make the array string convert to a string separate by "," , isn't it?
Cuz i a newbie...thx for ur patient
AlexTZ
This conversion can be done using own function. You can declare it in the report script.
Are you trying to pass values to sql "IN" operator (select * from table where field IN (@param1))? It will not work. You have to change the sql text before execution, instead of using a parameter.
waynepangXXX
QUOTE(AlexTZ @ Feb 10 2010, 06:49 PM) *
This conversion can be done using own function. You can declare it in the report script.
Are you trying to pass values to sql "IN" operator (select * from table where field IN (@param1))? It will not work. You have to change the sql text before execution, instead of using a parameter.


thx ~ problem solve~
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.