Last post Jan 08, 2019 06:22 PM by napet
Dec 28, 2018 04:25 PM|napet|LINK
I created an API that uses data from MYSQL in Visal Studio.
I am trying to create a stored procedure how I will be able to get data from MYSQL database on the server.
I created the procedure, but I don't see any icon to run and test the procedure in VS.
If I call the procedure from the API I get empty response (instead of result from the selection command in the stored procedure).
I wrote a query with the same select command and got the wanted results, but can't get that result by calling the stored procedure.
Can anybody help me please how to run and test the procedure, not from the code, but as run procedure in Visual Studio 2017?
Thank you in advance for your help!
Dec 28, 2018 04:53 PM|PatriceSc|LINK
Your code looks like https://dev.mysql.com/doc/connector-net/en/connector-net-tutorials-stored-procedures.html ? How do you read the rows returned by
this SP ?
If using try/catch make 100%M sure you are not doing handling this in a way it could get unnoticed (the earlier sample is IMO bad regarding this).
Dec 28, 2018 05:12 PM|napet|LINK
Yes, the procedure is like in the web site you sent. I used the same site when created the procedure.
But, is it possible to test the procedure using "run" or "execute" procedure in Visual Studio 2017?
I used execute or run to test the procedure when I was using SQL as a database in some other projects. But for MySQL I don't see any execute or run.
P.S. I have try/catch commented and the JSON response I get is:
Dec 28, 2018 06:10 PM|bruce (sqlwork.com)|LINK
Dec 28, 2018 06:48 PM|DA924|LINK
You can download Toad that is free the MySQL version and run the stored procedure to test it.
Dec 31, 2018 06:47 AM|Yohann Lu|LINK
You can also try the MySQL for Visual Studio.
MySQL for Visual Studio provides access to MySQL objects and data using Microsoft Visual Studio. MySQL for Visual Studio provides:
Design Time Support
Stored Routine Debugging
Chapter 2 Installing MySQL for Visual Studio
Jan 08, 2019 02:37 PM|napet|LINK
I decided to use raw SQL.
But the select with inner join of two tables returns only the data from the left table. I tried with left/right join, but same happens.
Can anybody help me why it is happening please?
This is my MYSQL Select:
string query = "SELECT t1.*, t2.* FROM t1 INNER JOIN t2 ON t1.ACCT=t2.ACCT WHERE t1.ACCT=t2.ACCT";
Jan 08, 2019 03:07 PM|PatriceSc|LINK
The JOIN condition should go only in the ON clause (rather than being repeated in the WHERE clause). Try :
string query ="SELECT t1.*, t2.* FROM t1 LEFT JOIN t2 ON t1.ACCT=t2.ACCT"; // or it seems your main table is the RIGHT table ?
Jan 08, 2019 06:22 PM|napet|LINK
I tried with left and right JoIn.
At the end I saw there was a already joined table in the database and I use that one now.