could not convert variant of type unicodestring into type double

Error occured in below function that "could not convert variant of type unicodestring into type double"
to line "ErrorText := 'Negative response: ' + Param.Value;"

There is Tparam class which has Value field of Ansistring type

function Result(var ErrorText : Ansistring) : Boolean;
var 
  ErrorCode   : integer;    
  Param       : TParam;
begin
  Result := False;
  
  Params.GetParamByName('ERROR_CODE', eptRead, Param);
  
  ErrorText := 'Negative response: ' + Param.Value;
  
end;


Please help me in this if anyone has any idea
0
Anonymous
11/23/2011 10:03:14 AM
embarcadero.delphi.vcl.using 2297 articles. 2 followers. Follow

7 Replies
5821 Views

Similar Articles

[PageSpeed] 40

Manoj Kurkure  писал(а) в своём письме Wed, 23 Nov 2011 14:03:14 +0400:

> There is Tparam class which has Value field of Ansistring type

what is this class and where taken from ?

> function Result(var ErrorText : Ansistring) : Boolean;
> var
>   ErrorCode   : integer;
>   Param       : TParam;

would anyone ever create it ?

what object would be parent of it ?

> begin
>   Result := False;

>  Params.GetParamByName('ERROR_CODE', eptRead, Param);


What is @Param value ? nil ?

-- 
Написано в почтовом клиенте браузера Opera: http://www.opera.com/mail/
0
Dmitry
11/23/2011 11:30:47 AM
Actually i have deleted some code in between, but TParam class is created and also param value is generation from one function call and i have deleted that. so dont worry about any such errors.

thanks in advance

> {quote:title=Dmitry Burov wrote:}{quote}
> Manoj Kurkure  писал(а) в своём письме Wed, 23 Nov 2011 14:03:14 +0400:
> 
> > There is Tparam class which has Value field of Ansistring type
> 
> what is this class and where taken from ?
> 
> > function Result(var ErrorText : Ansistring) : Boolean;
> > var
> >   ErrorCode   : integer;
> >   Param       : TParam;
> 
> would anyone ever create it ?
> 
> what object would be parent of it ?
> 
> > begin
> >   Result := False;
> 
> >  Params.GetParamByName('ERROR_CODE', eptRead, Param);
> 
> 
> What is @Param value ? nil ?
> 
> -- 
> Написано в почтовом клиенте браузера Opera: http://www.opera.com/mail/
0
Anonymous
11/23/2011 12:45:11 PM
> Error occured in below function that "could not convert variant of type unicodestring into type double"
> to line "ErrorText := 'Negative response: ' + Param.Value;"

While in this case it probably isn't your problem, get rid of AnsiString and use just string instead (database fields can be one thing, ordinary string variables quite another - legitimate use of AnsiString with the latter is very rare). Secondly, add either an explicit cast or a VarToStr call on the variant:

ErrorText := 'Negative response: ' + VarToStr(Param.Value);

The exception indicated Value held a floating point number, which leads the runtime to do a numeric addition rather than a string concatenation. Adding the cast or VarToStr call removes the ambiguity in your intentions from the runtime's POV.
0
Chris
11/23/2011 1:54:22 PM
Thank you for your information, but i have tried this casting but still i am getting the same error
> 
> ErrorText := 'Negative response: ' + VarToStr(Param.Value);
> 

I have some doubt that, i am using delphi RAD XE and installed component TPaxScripter by using project file (PaxScripter_D11.dproj). but i dont know this is compatible for RAD XE or not but that is compatible for Delphi 2007.

is this creating a problem or it is ok?

Please let me know if you have any idea about this.
0
Anonymous
11/24/2011 7:09:55 AM
> is this creating a problem or it is ok?
> 
> Please let me know if you have any idea about this.

I cannot help you if you make vague statements about a third party component instead of producing compilable code that exhibits your problem. For example, if you paste it into a new console application, does the following code work?

{code}
program Program1;

{$APPTYPE CONSOLE}

uses
  Variants;

var
  AnsiStr: AnsiString;
  V: Variant;
begin
  AnsiStr := 'something or other';
  V := AnsiStr;
  AnsiStr := 'Negative response: ' + V;
  WriteLn(AnsiStr);
  WriteLn('Press ENTER to exit...');
  ReadLn;
end.
{code}

If it does, find out the type of the data held by Param.Value via

 VarTypeAsText(VarType(Param.Value))

and report back.
0
Chris
11/24/2011 10:02:43 PM
+> {quote:title=Chris Rolliston wrote:}{quote}+
+> > is this creating a problem or it is ok?+
+> >+
 
+> > Please let me know if you have any idea about this.+
+>+
 
+> I cannot help you if you make vague statements about a third party component instead of producing compilable code that exhibits your problem. For example, if you paste it into a new console application, does the following code work?+
+>+
 
+> {code}+
+> program Program1;+
+>+
 
+> {$APPTYPE CONSOLE}+
+>+
 
+> uses+
+>   Variants;+
+>+
 
+> var+
+>   AnsiStr: AnsiString;+
+>   V: Variant;+
+> begin+
+>   AnsiStr := 'something or other';+
+>   V := AnsiStr;+
+>   AnsiStr := 'Negative response: ' + V;+
+>   WriteLn(AnsiStr);+
+>   WriteLn('Press ENTER to exit...');+
+>   ReadLn;+
+> end.+
+> {code}+
+>+
 
+> If it does, find out the type of the data held by Param.Value via+
+>+
 
+>  VarTypeAsText(VarType(Param.Value))+
+>+
 
+> and report back.+


Thanks for your information.

Sorry for statement and also for not giving full Information.

that code is working and Data type held by Param.Value is String.

but that code is contained in .PP file(Pascal Scripting) , i am executing that pp using my code.


Thanks in Advance
0
Anonymous
11/25/2011 6:12:40 AM
> Which proves you can't have a weird iss
> and Data type held by Param.Value is String.

Tell me what VarTypeAsText reports *exactly*.

> but that code is contained in .PP file(Pascal Scripting) , i am executing that pp using my code.

Are you saying the code you posted isn't Delphi code in the first place, but a script?
0
Chris
11/25/2011 2:12:27 PM
Reply:

Similar Artilces:

Could not convert variant of type (UnicodeString) into type (Double)
Hi I get this error on a TDFQuery when I try to make filter operation: First chance exception at $766FC41F. Exception class EFDException with message '[FireDAC][Stan][Eval]-118. Error evaluating expression. Could not convert variant of type (UnicodeString) into type (Double)'. Code: s1 := ALUECustomerName.Text; s := ' CustomerNr = '+s; DM_OF.FDQOrderTable.Filter := s; DM_OF.FDQOrderTable.Filtered := True; // On this line I get the error? The problem is just on this query and as far as I can see it is similar to other query's that works, What can cause this error, the error msg talks about double but it is only Integers /Ake Ake Pettersson wrote: > Hi > > I get this error on a TDFQuery when I try to make filter operation: > > > First chance exception at $766FC41F. Exception class EFDException with message '[FireDAC][Stan][Eval]-118. Error evaluating expression. Could not convert variant of type (UnicodeString) into type (Double)'. > > Code: > s1 := ALUECustomerName.Text; > s := ' CustomerNr = '+s; > DM_OF.FDQOrderTable.Filter := s; > DM_OF.FDQOrderTable.Filtered := True; // On this line I get the error? > > The problem is just on this query and as far as I can see it is similar to other query's that works, What can cause this error, the error msg talks about double but it is on...

Could not convert variant of type (UnicodeString) into type (Boolean)
I get "Could not convert variant of type (UnicodeString) into type (Boolean)" in Button1Click when I run this code. Can anyone tell me why this happens? //--------------------------------------------------------------------------- #ifndef Unit3H #define Unit3H //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> //--------------------------------------------------------------------------- class TForm3 : public TForm { __publ...

Type converter
I have a custom type converter on a class that is working fine on the "ToString()". I have the reverse coded into the CanConvertFrom(), but I can't seem to find a way to create the object from a String. Am I missing something here? Simply override the ConvertFrom method on your TypeConverter class. So take its input string value, process it, and have the ConvertFrom method instantiate and return an instance of your class.Hope that helps,WimWim Hollebrandse---http://www.zealandit.com         public override object ConvertFrom(ITypeDescriptorCont...

Cannot convert type 'type' to 'type'
I am learning all of this, so I am still fresh, so please bear with me :)I have a page that has some txtboxes in it, simple registration form, and I have a button that will save those txt boxes to the db. I am using:- I am using Visual Web Developer 2008 Express Edition- C# When I try to compile the project I get error: Cannot convert type 'System.Web.UI.WebControls' to 'String' This is content of my web.config    <profile> <properties> <add name="FirstName"/> <add name="LasttName"/>...

Option Strict On, converting an object to a type using a system.type variable.
I'm having problems trying to cast an object to a specific type. I have a system.type reference that I obtain from using Type.GetType("type_name"). But ctype does not allow me to pass in my system.type variable as the second param. It states that my variable is not defined. I have option strict on so it's forcing me to cast my variable before passing it until the method. Any suggestions? I've tried using the system.componentmodel.typeconverter.convertto and it still gives me the following: "Option Strict On disallows implicit conversions from 'System.Object' to 'MyType'. ...

Help with "Could not convert variant of type (OleStr) into type (Boolean)"
Hi everyone, I hope in right place, if im not sorry and show me the rightway =) anyway, I got a big and sick problem here, i have a automation application and it’s work verywell, but sametime the user open a tick with this error "Could not convert variant of type (OleStr) into type (Boolean)". This error occur and another day when we try to simulate step by step the error e problem not occur. So, I want to know where is it came from? How can I simulate it. > {quote:title=Guilherme Salvador wrote:}{quote} > Hi everyone, > > I hope in right place, if im not sorry and show me the rightway =) anyway, I got a big and sick problem here, i have a automation application and it’s work verywell, but sametime the user open a tick with this error "Could not convert variant of type (OleStr) into type (Boolean)". This error occur and another day when we try to simulate step by step the error e problem not occur. So, I want to know where is it came from? How can I simulate it. Because your olevariant data is not valid to covert it to boolean type Here are your test olevStr := 'abcd'; olevBool := vStr; //this will raise error to be safe, write a wrapper function to check and convert your self function olevToBool(const AVal: OleVariant): Boolean; begin if VarIsNull(AVal) or VarIsEmpty(AVal) then Result := False else if VarIsStr(AVal) then Result := (AVal = '1') or (AVal = 'Y') or (AVal = '...

Whan can i do? make "string" data type convert to "window" data type, and use a "window" name to get it ancestor "window name", thanks! i use pb5
Rich, With a string window name, you can open a window of that type if you need to. You could, of course, query that window object for any attributes. Another option is to use the LibraryExport function to export the definition of the window which is specified by the string. You can then parse the resulting file to get information on the ancestor object. HTH Sanjiv. "Rich" <windows_ce@netease.com> wrote in message news:2Xsr1WW0AHA.178@forums.sybase.com... > > > ...

Convert the name of a type
Hi there, How can I use a string parameter for a method and convert this to a type. I am using reflection to retrieve items within an enumeration: Dim fi As FieldInfo() = GetType(VehicleContractType).GetFields Currently I am creatnig a separate method for each enumeration in order to retrieve it's values. What I would like to do is pass the name of the enumeration as a parameter to the method and cast this as a type. Any ideas? Thanks, Ben   Ben Foster | RetroViz  Try: Type.GetType("MyClass")Hanan Schwartzberg--------------------http://w...

Object type cannot be converted to target type
I get the above error message when trying to display my module. It appears to occur inside a function in the business object that returns ArrayList object after pulling some data returned from IDataReader object from the data tier: Public Function GetAll() As ArrayList Dim infoList As ArrayList = Nothing Dim idr As IDataReader = Nothing Try idr = DataProvider.Instance().GetAll() infoList = DotNetNuke.CBO.FillCollection(idr, GetType(MyBusObjInfo)) ..... I did some search and it...

What java type to use for image type?
I am using JDBC to query image fields. Does somebody know what java type should I use for the mapping? Could you provide an example? 10x In article <PgINvC9YCHA.295@forums.sybase.com>, Peter <mn@mail.bg> wrote: > >I am using JDBC to query image fields. >Does somebody know what java type should I use for the mapping? BLOB >Could you provide an example? Not atm, sorry. /Mike ...

Convert Ntext type to XML type
 I have a ntext column which stores rows of xml data. Ive decided that the best way to query the xml data is to Convert the ntext data into xml data type and use Sql Server 2005 builtin Xml Query tools to perform FLWOR expressions. The problem Im having is getting the ntext data Converted to xml.When I try to convert the ntext text, I of course get an error that local variables of ntext type are invalid.Any suggestions on a way I might accomplish this?Thanks, -lance Hi, From your description, it seems that you met trouble while you are going convert the field type from ntext to xml, ...

what is typed dataset, in which scenario we use typed dataset ?
what is typed dataset, in which scenario we use typed dataset ? The introduction to this set of tutorials answers that question: http://www.asp.net/learn/data-access/  Regards Mike [MVP - ASP/ASP.NET]My site...

VB
I need to convert a BitMap Variable Type into a String Variable Type, then convert it back to a BitMap type. Any ideas on how I can accomplish this? I was thinking along the lines of using a MemoryStream, but am having trouble understanding the process I would need to proceed on to perform this. Sample Code bits would be greatly appreciated. James James: I've used this code to take a serializable collection to a binary format and I've been able to save it in a SQL Server table field.. Dim ms As New MemoryStream() ' Create a memory stream... Dim bf As New Binar...

Unable to cast object of type 'TYPE' to type 'TYPE'.
I've got a custom class and collection...I want to use them to databind a Grid, and persist the state using a Session variable.  However I keep getting the above error **Sometimes...There will be times when it works fine, and times when it totally craps out.System.InvalidCastException: Unable to cast object of type 'ApprovalCycleCollection' to type 'ApprovalCycleCollection'. This should work fine, no?  I want a property to use in all my foreach loops   public ApprovalCycleCollection NewApprovalCycle { get { if (Se...

type overwrites other type
Name: Pu Email: padhealedatyahoodotcom Product: Firefox Summary: type overwrites other type Comments: type doesn't fit or overwrites other type see bottom of page. http://www.startupnation.com/homebased100/ Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB6 (.NET CLR 3.5.30729) From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

the question about the variant type convert?
who can tell me how to convert the string type variant to the datetime type in c#@? waiting for your reply!thanks a lot for reply! Have you tried: string myString = "03/23/1975"; DateTime myDate = Convert.ToDateTime(myString); ?Craig ShoemakerPolymorphicPodcast.com - The show about object oriented development, architecture and best practices in .NET...

Type of derived childnodes becomes type of base type after postback
Hi, I'm building a web application with a custom treeview, that has several types of custom treenodes in it. One custom node, which is always a root node in the treeview, is also the base class for the other custom node type. So I have:CustomTreeView           (inherits from TreeView)CustomTreeNodeRoot   (inherits from TreeNode)CustomTreeNodeChild   (inherits from CustomTreeNodeRoot) Everything is working fine except the CustomTreeNodeChild after postback. That's because after postback it's type has changed to CustomTreeNodeRoot and lost all of it's additional functionality. I've also tried to do a widening conversion, but the debugger then says: Cannot convert to 'Class CustomTreeNodeChild'.I actually had the same problem with CustomTreeNodeRoot becoming a TreeNode type again. The solution here was to override the SaveViewState and LoadViewState methods of CustomTreeNodeRoot. After that, the type was preserved including all the property values that I added in this method.But when I override these methods in CustomTreeNodeChild, as shown below, I get an exception during runtime (after a postback where CustomTreeNodeChild's LoadViewState should be called) in LoadViewState of CustomTreeNodeRoot: Unable to cast object of type 'System.Object[]' to type 'System.Collections.ArrayList'. The exception occurs at line 16 in the code of CustomTreeNodeRoot. 1 ...

convert money type to Double. Possible???
Is it possible to convert Money type to a Double type. Why not use decimal? That's the data type that most closely matches Money.Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you!...

VB.NET "cannot convert type A into type A" driving me crazy!
Hi, in the aspx I have declared a structure "InsFlds" as follows: Structure InsFlds Dim Value AS String Dim CtlName AS String Dim CtlType AS Integer End StructureThen I'm setting up an array to hold some of these:DIM InsValDefaults(26)AS InsFlds And in the next lines I am checking a session-variable and, if it exists, assign it to that array:IF Session("InsValDefaults") IsNot Nothing Then SiAuto.Main.LogObject("Session(InsValDefaults)",Session("InsValDefaults")) InsValDefaults = Session("InsValDefaults") ...

Converting Gridview Checkbox data type into new Label data type
I have a backend page where the client can check boxes of available time slots.  The frontend takes that boolean(bit) value, to change the label property, if False, returns lbl.Visible=false and changes the label text to a hard coded time value (i.e. 5am); using an if statement.  Here is my example...Thank you so much for any input, this site and members are the best. Code Behind:protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e)    {        if (e.Row.RowType == DataControlRowType.DataRow)        {            Control a = e.Row.FindControl("Label1");              ...            if (((Label)a) == false)            {                ((Label)a).Visible = false;            }            else            {                ((Label)a).Value = "5";              &nbs...

"cannot convert from sql type 4 to C type 93"
We recentlu upgraded from PB 8 to PB 10.2. we are using Sybase 12.5 & connecting via ODBC. After the upgrade we are getting the error msg "cannot convert from sql type 4 to C type 93" on one of the reports. If I run the report on PB8, there are no errors. Pl. help First please do not crosspost. Second if this is different functionality I would contact support and open a case. Also try running with database tracing so you can see the syntax different. Set your dbms to "trace odb" to turn it on. You can do this in both PB8 & 10. -- Larry Cermak [Team Sybase] Branick Consulting, Inc. www.branick-inc.com EAServer & PowerBuilder Consulting & Training EAServer and PowerBuilder Computer Based Training Courses <AR> wrote in message news:44035976.427b.1681692777@sybase.com... > We recentlu upgraded from PB 8 to PB 10.2. we are using > Sybase 12.5 & connecting via ODBC. After the upgrade we are > getting the error msg "cannot convert from sql type 4 to C > type 93" on one of the reports. If I run the report on PB8, > there are no errors. > Pl. help ...

How to convert varchar data type into datetime data type without data lose
Hi all, i have stored date as varchar(30) data type and Date format is dd/MM/yyyy now i have to convert it into datatime data type can u help me in query ?  i have 330 records and each recod contain the Date in format of dd/MM/YYYY but due to varchar data type i can not perform calculation on Date so i have to convert into datetime without data lose. please help me in this regard. Best RegardsRameezWaheed  life is name of learning!Mark as an answer if it helps You can check these posts http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=2039108&SiteID=17   ...

How to eliminate ".00" after converting money type become varchar type ?
I just converted a variable which is money type by CONVERT function by specifying format 1 so that it's shown comma for each thousand. But I also want to show it witout ".00"   What should I do to solve this? Could anyone give me suggestion?   I would use ROUND function. Check http://msdn.microsoft.com/en-us/library/ms175003.aspxBeware of bugs in the above code; I have only proved it correct, not tried it. (Donald Knuth) Hi,unpungman Please Post Some Test data which u have in ur database . And what u required in output.   Thanks.RAGHAV MVP ASP/ASP....

value of type 'XXX' cannot be converted to type 'XXX'
 I've had this issue with VS2008 lately that is driving me crazy.  I have a website where I built a class that does all my Web Service interaction.  This class returns instances of Web Service proxies, or list of the same.  In my web page I'll create a temporary variable (Dim - I'm using VB) with the same type that my service class is going to return.  When I assign my variable to the return of the method, I'm getting a message similar to the following"Value of type 'Namespace.Foo' cannot be converted to type 'Namespace.Foo'. ...

Web resources about - could not convert variant of type unicodestring into type double - embarcadero.delphi.vcl.using

Free Pascal - Wikipedia, the free encyclopedia
2.6.4 / March 11, 2014 ; 45 days ago ( 2014-03-11 ) ) is a free Pascal and Object Pascal compiler . In addition to its own Object Pascal dialect, ...

Saxonica
As I explained in my previous post, I've been re-examining the way functions work in Saxon. In particular, over the last week or two, I've been ...

Index of /unifont Proposal for a GNU Unicode Font
If we want Unicode to become a standard for average users then wecannot expect them all to go hunting for nice font combinations thatmay or may ...

C++ Reference - RAD Studio
This section contains reference material about using C++Builder in RAD Studio. In particular, the C++ Specifics section in the C++ Language ...

SmartInspect User Pages
About Us TestRail SmartInspect Blog My Account Overview Features Pricing & Buy Customers Extras Support Try SmartInspect SmartInspect user-specific ...

Encoding.Convert Method (Encoding, Encoding, Byte[])
... Imports SystemImports System.TextImports Microsoft.VisualBasicNamespace Convert_Example Class MyConvertExampleClass Shared Sub Main() Dim unicodeString ...

Delphi Regular Expressions Classes
Delphi XE is the first release of Delphi that has built-in support for regular expressions. In most cases you'll use the RegularExpressions unit. ...

PHP :: Bugs :: Search
php.net - support - documentation - report a bug - advanced search - search howto - statistics - random bug - login go to bug id or search bugs ...

Libuninum
Version 2.7 adds support for Kayah Li, Lepcha, Ol Chiki, Saurashtra, Shan, Sundanese, and Vai.Full width characters are now accepted in Western ...

Reference for unit 'System': Types
[ Overview ][ Constants ][Types][ Classes ][ Procedures and functions ][ Variables ][ Index ] Reference for unit 'System' ( #rtl ) Reference ...

Resources last updated: 3/8/2016 5:00:51 PM