Visual Studio 2013 Query editor errors and MYSQL - c#

I have the following MYSQL query:
SELECT
stat_number,
sqldate,
sqlvalue,
ID,
CAST(GROUP_CONCAT(IF(YEAR(sqldate)= 2013, sqlvalue, NULL)) AS UNSIGNED) AS Y2013,
CAST(GROUP_CONCAT(IF(YEAR(sqldate)= 2014, sqlvalue, NULL)) AS UNSIGNED) AS Y2014,
CAST(GROUP_CONCAT(IF(YEAR(sqldate)= 2015, sqlvalue, NULL)) AS UNSIGNED) AS Y2015,
weekofyear(sqldate) AS `weekofyear(sqldate)`
FROM statval1
WHERE (stat_number = 495) AND (sqldate >='2013-01-01' OR sqldate <'2015-12-31')
GROUP BY weekofyear(sqldate)
ORDER BY weekofyear(sqldate)
It works great everywhere else EXCEPT in Visual Studio 2013 query Editor,
Does anyone knows how to make it work? or what is wrong with the query editor?
I keep getting the error:
Error in list of function arguments: '=' not recognized. Error in list
of function arguments: 'AS' not recognized. Unable to parse query
text.
If i ignore the error and keep going the datagrid seems to display the correct data, but nothing shows in the charts, I get no columns at all to select the x,Y axis. I recently started learning C# in Visual studio 2013 and I am trying to recreate a software that I made in PHP/MYSQL and recreated in Object Pascal/MYSQL but this is really putting me off visual studio.
It only took a couple of weeks to create a reporting software in Lazarus, pascal programming from not knowing anything at all, and it has taking me a week just to get MYSQL server talking properly with in Visual Studio 2013 and now the query do not work, but they work perfectly fine with object-pascal, PHP, JAVASCRIPT, ETC.

The lines baffling VS2013 are the ones like this:
CAST(GROUP_CONCAT(IF(YEAR(sqldate)= 2013, sqlvalue, NULL)) AS UNSIGNED) AS Y2013,
Your query works OK otherwise in VS2013.
But, what does this query mean? Are you sure it's well formed? You're taking advantage of MySQL's nonstandard extension to GROUP BY in an inscrutable way. Read this: http://dev.mysql.com/doc/refman/5.6/en/group-by-handling.html
You might consider reworking this query so it's standard.
Also, this date selection logic omits the last day of 2015. Is that what you want?
(sqldate >='2013-01-01' OR sqldate <'2015-12-31')

I could be wrong, and will be glad to be proven wrong but the VS 2013 query editor is geared towards MS SQL and only knows that syntax. The query is ok for MYSQL but in MS SQL you can not name a variable inside a function call.
Anyone else have any insight into this as I'm now curious as well?

My advice is : try to remove each attributes of the select statment and test if the query is responding an error.
With this way you can locate which attribute is giving that error.
I think , but im not sure that, the error is caused by thos : ‘ ’
Try to remove them as well.

Related

How to make C# 2017 IntelliSense work like 2008?

In Visual C# 2008 Express, the IntelliSense is great, e.g. I only have to type Conso.( and it will insert Console.Write(
That works as follows:
(i) Conso is enough disambiguation to select Console in the list; (ii) typing . automatically inserts that highlighted word and adds the dot too; (iii) now the dropdown list shows Console's members, defaulting to Write [based on my usage frequency?], (iv) now typing ( automatically inserts that highlighted word and adds the bracket too.
Note that I did not need to type any of the letters of Write, nor all of Console, nor did I have to press Space, Tab, Enter etc. to confirm anything.
I have now upgraded to VS 2017 and the autocomplete works differently. You have to press special keys (Tab, Enter etc.) to insert the word from the list. It won't insert the highlighted item for you automatically as soon as you move on to the next punctuation.
Having to select all these list items manually is murdering my productivity. I can see some autocomplete options in the Tools>Options but I find nothing that can achieve what I had in C# 2008. Is it still possible? How?
It seems this issue was removed from the VS 2017 and VS 2015, I tried to help you report this user voice to the VS Product Team, please check this: C#>Intellisense: please auto pre-select the common used members like the previous VS version and you can also add a comment in there to trace the feedback from the VS Product Team engineers.

Visual Studio Go to All (ctrl + ,) going to first search result without showing list of results

Whenever I use Go To on Visual studio 2017 and I start typing something it will just find the first occurrence of whatever I typed and go to that file without showing me a list of Classes / Methods like it used to do before. Right now I don't see any list of possible results and it's making it pretty hard to navigate my code. I have been looking online and couldn't find a solution to this. What can I do to get that list of results to show up?

C# and Crystal Reports SDK - Selection Criteria Ignored

I have a crystal reports rpt file being called from C# code. Report works as expected from Designer within Studio 2010. Same report ignores Selection Criteria when called from C#, but ONLY when including a certain table's field in the criteria.
Current Criteria Example :
date({transaction.transaction_date}) in {?FromTo} and
{user_branch.branch_id} = 1
{?FromTo} is a date range parameter which works perfectly
When I remove the branch_id section, the {?FromTo} date parameter is checked correctly and the data returns as expected. BUT, as soon as I include the branch_id field, ALL the data is returned, which does not make sense at all.
Running this exact same report via the designer, works correctly... The problem occurs when running via C# SDK code.
Any help with this will be GREATLY appreciated
Already Tried
Recreate Entire Report from Scratch bit by bit, table by table. This works up to a point where I start adding more fields to the report itself, no one in particular, then the problem starts up again... So obviously, I start back tracing my steps until the entire report is empty again, but the problem persists, like the file is now "broken"
No similar issues in google... No where in my code is a line emptying the selection criteria during code... My other reports not accessing that table works fine.
Currently using version 13.0.1 of the CR Runtime. Tried to upgrade to 13.0.2, still didn't work
Ran the exact same SQL that the report generated directly against the database. That works as expected.
Try changing your criteria to:
(date({transaction.transaction_date}) in {?FromTo}) and
{user_branch.branch_id} = 1
Adding the date({transaction.transaction_date}) in {?FromTo} line inside a (). I'm not just sure.
After many head-aches this week, I finally found the problem... This looks like a bug in the SDK itself though, but to solve the problem, just make sure that the field giving the problem mentioned above is contained in the detail section of the report.
i.e. I added my branch_id field to the detail section of the report and suppressed it. It works by suppressing the section as well, just as long as the field is contained there.
I tested this on all my other reports with the same problem and it worked.

mysql sntax error using sqldatasource in asp.net

Hi I keep getting this error using a sqldatasource in asp.net, I can connect and see mysql schema and it lists everything fine but every query I test is returned with an error even the manualy inputted ones.
Visual Studio IDE doesn't supports schemas yet, so you would need to manually Pre-pend Table's Schema name in the Query.

C# dataset insert query issue from access database

I'm using Visual Studio 2008 and an Access 2007 database.
While I'm trying to create a new insert query in my DataSet, the insert stored procedure mixes up the database field values.
I have a print screen of the problem here: http://netplague.eu/Capture.PNG
As you can see in the attached print screen the table clients is displayed and below the InsertClient stored procedure. My problem is that the parameters are all mixed up.
Is there a solution to this problem or is it just a visual studio bug?
Thank you.
It's probably just a display order issue.
If you are inserting the parameters in alphabetical order of the field names, but Visual Studio is displaying the fields in the order they are defined in the database (for example), this would explain the difference.
I had your same problem. I have fixed it installing the service pack 1 for Microsoft visual studio 2008. I hope this help.
Simone

Categories