Error Type mismatch for field ,expecting: WideString actual: String

Hello all:

Platform: Delphi XE5 Enterprise

Database: Firebird 2.5

I've a query with a persistent Field.

If execute in Design mode, work ok.

In execution time i received Error  Type mismatch for field ,expecting: WideString actual: String .

In conection.params I've add Params.Values['UseUnicode'] := 'False';

Thanks in advance
0
Alfonso
1/17/2014 8:31:56 PM
embarcadero.delphi.firedac 822 articles. 2 followers. Follow

2 Replies
7436 Views

Similar Articles

[PageSpeed] 3

Alfonso Presa wrote:
> Hello all:
> 
> Platform: Delphi XE5 Enterprise
> 
> Database: Firebird 2.5
> 
> I've a query with a persistent Field.
> 
> If execute in Design mode, work ok.
> 
> In execution time i received Error  Type mismatch for field ,expecting: WideString actual: String .
> 
> In conection.params I've add Params.Values['UseUnicode'] := 'False';
> 
> Thanks in advance

It is exactly what the error says.  Your persisted field is a TWideStringField. 
  But the connection param you are adding says created TStringField.

If you set that to false, you must go back and re persist any persisted field 
you have already made that were TWideString so they will get persisted as 
TStringField.

When you persist a field you are basically telling the app that you want it 
snapshotted exactly that way at the time of persistence.  By changing that 
connection parameter you are changing the basic string type from Unicode to Ansi 
so the field that would be persisted (or created dynamically) is different.

Are you sure you even need it?  I haven't tested it, but I would expect FireDAC 
to have no issues taking a TWideStringField and putting its contents into a 
database expecting ANSI data.  It should encode it to the right string type 
before sending it over the wire.

-- 
Jeff Overcash (TeamB)
       (Please do not email me directly unless  asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted  corridors of Whitehall.
              (Fish)
0
Jeff
1/17/2014 9:56:38 PM
Hi Jeff:

When i created persistent field (in TFDquery, rigth button, add all fields), the field has automatic created with Tstringfield type.  And it's correct.
This is a field in the query:

Select t.field1, t.field2 ,(select nombre || ' ' ||  ape1 || ' ' || ' ' || ape2  from usuarios us1 where us1.codigo_usuario=p.responsable_interno ) responsable_interno from  table t

If in design time, right button click, query editor, execute this query , execute ok. 

What's wrong?.

Alfonso

> {quote:title=Jeff Overcash (TeamB) wrote:}{quote}
> Alfonso Presa wrote:
> > Hello all:
> > 
> > Platform: Delphi XE5 Enterprise
> > 
> > Database: Firebird 2.5
> > 
> > I've a query with a persistent Field.
> > 
> > If execute in Design mode, work ok.
> > 
> > In execution time i received Error  Type mismatch for field ,expecting: WideString actual: String .
> > 
> > In conection.params I've add Params.Values['UseUnicode'] := 'False';
> > 
> > Thanks in advance
> 
> It is exactly what the error says.  Your persisted field is a TWideStringField. 
>   But the connection param you are adding says created TStringField.
> 
> If you set that to false, you must go back and re persist any persisted field 
> you have already made that were TWideString so they will get persisted as 
> TStringField.
> 
> When you persist a field you are basically telling the app that you want it 
> snapshotted exactly that way at the time of persistence.  By changing that 
> connection parameter you are changing the basic string type from Unicode to Ansi 
> so the field that would be persisted (or created dynamically) is different.
> 
> Are you sure you even need it?  I haven't tested it, but I would expect FireDAC 
> to have no issues taking a TWideStringField and putting its contents into a 
> database expecting ANSI data.  It should encode it to the right string type 
> before sending it over the wire.
> 
> -- 
> Jeff Overcash (TeamB)
>        (Please do not email me directly unless  asked. Thank You)
> And so I patrol in the valley of the shadow of the tricolor
> I must fear evil. For I am but mortal and mortals can only die.
> Asking questions, pleading answers from the nameless
> faceless watchers that stalk the carpeted  corridors of Whitehall.
>               (Fish)
0
Alfonso
1/17/2014 10:35:59 PM
Reply:

Similar Artilces:

FireDAC -Type mismatch for field expecting largeint actual widestring
Oi, Estou com problema no componente TFDQuery do FireDac em aplicacao Firemonkey mobile Aparece a mensagem "Type mismatch for field 'CAMPO', expecting: LargeInt actual WideString O erro so aparece no iOS Device ou simulador. Na plataforma Windows esta normal. O driver do TFDConnection e SQLite O 'CAMPO' foi configurado como 'LargeInt', mas ao abrir a query o aparece a mensagem de erro acima. Translate: I'm having trouble in the TFDQuery FireDac component. App Firemonkey mobile "Type mismatch for field message 'FIELD', expecting: LargeIn...

FireDAC -Type mismatch for field expecting largeint actual widestring [Edit]
Oi, Estou com problema no componente TFDQuery do FireDac em aplicacao Firemonkey mobile Aparece a mensagem "Type mismatch for field 'CAMPO', expecting: LargeInt actual WideString O erro so aparece no iOS Device ou simulador. Na plataforma Windows esta normal. O driver do TFDConnection e SQLite O 'CAMPO' foi configurado como 'LargeInt', mas ao abrir a query o aparece a mensagem de erro acima. Translate: I'm having trouble in the TFDQuery FireDac component. App Firemonkey mobile "Type mismatch for field message 'FIELD', expecting: LargeIn...

Type mismatch for field 'xxx', expecting: WideString actual: String
Development Enviornment Delphi XE2 oci.dll 11.2.0.1 sqlncli10.dll 2007.100.2531.0 MS SQL Server 2000, 2005, 2008. Collated Arabic_CI_AS Oracle 11g NLS Characterset WE8ISO8859P1 Application using datasnap/dbexpress driver Windows XP Problem Area We have an application that we are converting to runs on both Oracle and MS SQL Server. The Oracle driver brings back Varchar2 as TWideStringField. The SQL Server driver brings back Varchars as TStringField. This becomes a problem for our persistent fields. The error we receive is "Type mismatch for field 'xxx', ex...

Type mismatch for field 'FieldName', expecting: AutoInc actual: LongWord
Hi, I get this error message with AnyDAC (FireDac) components. To show my error, I reduce my mysql table to the minimum. I have two MySQL table who contains many fields of type (string, integer, datetime etc...). The first table named "ReportLog" contain three fields: 'ID' (INTEGER AutoIncrement) 'RptDateTime' (DATETIME) 'fk_OperatorLog' (INTEGER) The second table named "OperatorLog" contain two fields: 'OperId' (INTEGER AutoIncrement) 'DKeyId' (VARCHAR) I put a TFDQuery (na...

Type Mismatch field 'EventDate' expecting: Date actial:Widestring
Hi In an SQL database I have a field with a data type of ‘Date’. In FireDAC I have this field also setup as a TDateField. I have used LiveBindings to connect a TEdit to the ‘EventDate’ data field, which is where I imagine the problem comes from. What I can’t understand is why it works fine on my local copy of SQL and the ‘live’ SQL Server from my own laptop (which is using Delphi XE5) but gives an error message when run on a clients PC. On a Users PC I get an error message ‘Exception eDatabaseError in module …. At ….., fdqCalendar: Type mismatch for field ‘EventDate’, expecting: Date actua...

Type MisMatch Error With String
I am getting a type mismatch error for some reason with my string field. I dont understand why because pretty much ANY value I put in should be valid for a string.  1 UpdateCommand = "UPDATE Schedule SET Professor_ID = @Hidden_Professor, Course_Start_Time = @Hidden_Start_Time.Value, Course_ID = @Hidden_Course, Campus_ID = @Hidden_Campus, Term_ID = @Hidden_Term, Course_Days = @Hidden_Days WHERE (Schedule.ID = ?) " 2 3 4 <asp:TemplateField > 5 <EditItemTemplate> 6 <asp:HiddenField ID ="Hidden_Start_Ti...

Date field Data Type Mismatch error
I have exhausted all of my references and cannot find a solution to this anywhere.  I have a table in an Access db on my server (tblTemp).  I've created an .aspx page with a text box for the users to enter a date like 4/1/2007.  All of my other text fields post to my table perfectly, number and text fields, but when I enter a date in I get a "Data Type Mismatch" error. I have two books on asp.net and neither one of them address date fields and have been unable to find anything on the web so it must be something either incredibly easy that it doesn't need to be mentioned ...

Delphi XE3 Size Mismatch for field error
I already posted this in the Delphi/General group but this is a better place for it so I'm reposting. Can anyone tell me please where I can find the thread that Jeff Overcash mentioned below, or alternately tell me how to fix the problem please? TIA From my previous post..... Satara IT Department wrote: Hi, I'm converting one of my apps to XE3 (from XE2), I thought it was all going splendidly , i.e. I didn't have to make any code changes (except something to do with the OnGetTableName event which I've asked about in a separate post) to get it to build, but when ...

Error: Cast from type DBNull to type String is not valid
Hi,I get the following error when I try to convert to string.  I know for a fact that the result "UniversityMajor" is empty at this point (null), and that's why I got this error, but I get it even after checking If Not IsDBNull(.UnivMajor)....plz helpThanks,System.InvalidCastException: Cast from type 'DBNull' to type 'String' is not valid.Source Error: Line 732: With ApplicationPart2 Line 733: If Not IsDBNull(.UnivMajor) Then Line 734: .UnivMajor = CType(result("UniversityMajor"), String) Line 735: End If Line 736: ...

Error message:fatal error field type file is not supported for this function
 Any help would be greatly appreciated.I have an ascx file which contains a datagrid containing:<asp:FileUpload ID="FileUpload1" runat="server"  /><asp:Button ID="Button1" runat="server"  CommandName = "UploadFile" Text="Submit File" /> This ascx file is loaded into an aspx file. The aspx file contains this line:<form id="frm" name="frm" action="PageLoader.aspx?page_id=<%=pageId%>" method=post  enctype="multipart/form-data" runat="server">&...

Error:Type Expected
I did create one simple program which is used to retrieve data from SQL Server Database into the DataGrid. Unfortunately,compilation stops at the position that 'Dim conn as SQLConnection'.The error is just same as the subject 'Type Expected'. By the way, the default frameworkSDK from VS.NET version 1.0 lies different place from .NET1.1 I did install recently.If so, I wonder which FrameworkSDK will be used if I'm intending to compile ASP.NET Web Application. Looking forward to your timely kind reply! At the top of your page with the code, are you importing the System.Data namespace? ...

Stored Proc Error: error converting character string to smalldatetime data type
I am trying to create a page that adds users to a MS SQL database. In doing so, I have run into a couple errors that I can't seem to get past. I am hoping that I could get some assistance with them. Error from SQL Debug: --- Server: Msg 295, Level 16, State 3, Procedure AdminAddUser, Line 65 [Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting character string to smalldatetime data type. --- Error from page execution: --- Exception Details: System.Data.OleDb.OleDbException: Error converting data type varchar to numeric. Source Error: Line 77...

Cast from type 'Field' to type 'String' is not valid
I am getting the error msg on this code...Response.Write(objRSCount("iCount") & " records for " & frmDispOption & " '" & frmText & "'. They are listed below:")I have tried converting the frmDispOption and frmText variables to strings using CStr after getting the values from the DB but still get the same msg.  Can someone please help me out, thanks.David. What is "objRSCount"? ie what type is it? You also need to make sure that objRSCount("iCount") is string.ThanksMark post(s) as "Answer" that helped youElectronic ScrewWebsite||Blog||Dub@i.net Hi, i f...

PFC Error
hi everyone, i am using pb 9.0.1 build 7275. i have just performed a full rebuild and got these errors. these objects have never been touched by me and were working and building fine. could it be cause i installed the latest ebf? See Errors: pfcapsrv.pbl(pfc_n_cst_error).pfc_n_cst_error.of_processlog.43: Error C0174: Type of actual parameter cannot be ancestor of formal reference parameter type. pfcapsrv.pbl(pfc_n_cst_inifile).pfc_n_cst_inifile.of_delete.123: Error C0174: Type of actual parameter cannot be ancestor of formal reference parameter type. pfcapsrv.pbl(pf...

Web resources about - Error Type mismatch for field ,expecting: WideString actual: String - embarcadero.delphi.firedac

Resources last updated: 2/10/2016 4:21:24 PM