Data truncated error via ODBC - c++

i'm trying to query a table with c++ odbc using 'sql driver'.
While i'm trying to open the table using my query i get 'Data truncated.' error. I checked it out, the data i'm passing for that query is no longer than 255 in length, i think it is a bug.
did some one solved that issue? any suggestions?
windows 7, sql server 2008, vs 2010.
Thanks in advance.

the fix up
check not only the parameter you pass during open but also the fields that are being transferred during DoFieldExchange() function, in my case that was another record field that was transferred to me from the sql and messed things up.
refer the link for the fix up.

Related

Why do I see read-write error message when creating a table or inserting rows?

I keep getting a "could not open read-write messages" when creating a table or inserting rows?
2022-10-21T17:27:11.336011Z I i.q.c.l.t.LineTcpMeasurementScheduler could not create table [tableName=cpu, ex=could not open read-write
io.questdb.cairo.CairoException: [22] could not open read-only [file=/root/.questdb/db/cpu/service.k]
I have tried the troubleshoot solution given in QuestDB forums but it does not work.
If you could explain why it does not work along with the solution, I would appreciate it.
There are possibilities for insufficient limits for the maximum number of open files. Try and change that limit for your device. You can check more about that here
I think that the syntax which you used was incorrect. Have you checked, whether the table was created properly or not ?
If not, create the table
CREATE TABLE my_table(symb SYMBOL, price DOUBLE, ts TIMESTAMP, s STRING) timestamp(ts);
After creating the table properly, then try to insert the rows.
You are likely hitting a bug which was fixed recently:
https://github.com/questdb/questdb/pull/2627
The fix will be released in the upcoming 6.5.4 release.
Unfortunately not out yet.
Please, try 6.5.4 when it is released, should be out in the next few days.

PowerBI subscription error : there is no data for the field at position x

We have run a PowerBI subscription to generate visualisations report in PDF format we have get many errors like this
There is no data for the field at position x
The problem is we searched many times about it we found that it may occurred due to missing data in dataset.
But we have about 30 datasets with a query to oracle database we cannot figure out which is the missing data and the log does not mention which report causes the error.
Is there a way to figure out which field is missing?
Or is there a way to enrich the reports error log to give us which report failed?
A sample of exact error is repeated with different positions :
processing!ReportServer_0-8!1e18!02/07/2022-09:56:36:: e
ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: , Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: There is no data for the field at position 29.;
Dears
I found a solution help me. I will share it.
The error is due to missing data, not missing values, which means the column name defined in the data set field has been changed in the database.
note:
When make the value equals null it will not give the same error; even if it is used in the report it will give a different error.
about how to detect ?
Simply install report builder in machine has connection to this database and open this report with report builder and make verify fields, it will give detailed error with the name of dataset fields not found so we tracked it in database we found it has been changed so fix it in either dataset or column name in database it fix the issue.
New challenge we are going to handle it either column name exist or changed to e, never get error and give empty report better as there is some database the report will connect may not have the same column names so it should give empty part of report instead of error.
thanks BR,

CRecordset fails on adding a new row using the free ODBC driver for SQLite

I have an C++ application using MFC CRecordset to add rows to a table of an SQLite database, using the free ODBC driver by Ch. Werner. For this, I use the usual sequence of rs.Open(), rs.AddNew(), set values, and finally rs.Update().
This works on a small example, but with my actual database rs.Update() fails with error -1 and the following error message: unrecognized token: ""RedFaktorFly" (1). The 'token' is a truncated name of column 14 of the table, whose full name is "RedFaktorFlyt".
In some runs, it appends seemingly random characters, so the message becomes for ex. unrecognized token: ""RedFaktorFlyH" (1).
Interestingly, when I add "LongNames=true" to the ODBC connection string, which prepends table names to the column names and therefore makes the SQL query longer, the error becomes (for ex.) unrecognized token: ""K_Noder.MaxKompresjox" (1) - where "MaxKompresjonsFaktor" is the name of column 10 of the table.
This seems to suggest that there is a limit on the length of a SQL query accepted by the driver - but it seems strange that such a limit would be so small that it would fail already with 14 columns.
I do not think that the limit is in the C++ part, since the same code works fine both with the (commercial) SQLite driver from Devart and with Microsoft's ODBC driver for Access.
I tried adding a TraceFile option to the ODBC connection string, but it does not seem to do anything, so I do not know what exactly gets sent to the ODBC driver.
I see the same behaviour both with 32- and 64-bit builds, using Visual Studio 2015 on Windows 10.
Any suggestions what to try next?
I'll give you a solution to solve your issue completely. I don't know if it's suitable for you, but definitely it works. I successfully use it on my own.
For any operation except listing records, use CDatabase, not CRecordset. So, to insert rows to any table, to update records, to delete records, use CDatabase. To retrieve records from SQLLite database, use CRecordset. I can give you examples if you need.

PowerBI EnableFolding

September update have changed how to consume data from Postgres.
M code will change to something like this:
Value.NativeQuery(PostgreSQL.Database("server", "db"), "query", null, [EnableFolding=true])
How can I change to function as before the update?
PostgreSQL.Database("server", "db", [Query="query"])
Or now I would need to do it manually?
Regards,
Finally Microsoft gave me the workarond: just remove [EnableFolding=true] from query, advance editor (the one showing the m language)
Right yesterday I went into the same issue.
Data refresh now works only from desktop while fails for any new query created with latest Power BI once published on service.
Tried to set EnableFolding=false and EnableFolding=none as error message suggests but both throwing a error.

Recordset Update errors when updating sql_variant field

I'm using C++ and ADO to add data to a SQL Server 2005 database. When calling the Recordset Update method for a sql_variant column I'm getting the error DB_E_ERRORSOCCURRED and the error message Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. If the value I'm adding is NULL all works fine and all values going to the fields that are not sql_variant types work.
Does anyone know what I might be doing wrong?
Thanks
[Edit] I have some more information. The value we are storing is the empty string - ADO appears to want to store this in the sql_variant as a nchar(0), which of course is not a valid SQL data type. Is there a way to get an empty string in a sql_variant using the ADO batch commands?
You are only being shown the outer-most error there and as the error suggest you need to check the inner errors to find out the problem.
Apologies, I'm a VB developer but if you loop through the errors on your connection object you should be able to pinpoint the actual error.
From my classic ADO days multiple-step errors usually pointed at trying to stuff something to big into your column, e.g a string thats too big or a number with too high precision.
Hope this helps.
Ed