Last post Jul 29, 2015 01:03 PM by Weibo Zhang
Jul 15, 2015 02:01 AM|mokwenak|LINK
Execute an MSSQL Stored Procedure against a MYSQL database
I have an MSSQL database that must get selected fields from MYSQL database and insert them on my sql database.
I have created a linked server and can perform simple queries against the MYSQL database but I am not sure how to run an MSSQL stored procedure against the MYSQL database. i'm thinking of having insert trigger on my MySQL table to call a procedure on MS
SQL that will select and insert the field i want.
Can anyone help?
Jul 15, 2015 10:42 PM|Lannie|LINK
Are you gathering data in fields on a form then inserting?
If so, you do not need trigger. You can insert using >NET code behind your form...
or you can use .NET to call a stored procedure that does the insert.
Example code behind form inserting a row derived from form data entry
Using SQLConnection As New MySqlConnection(connectionString)
Using MySqlCommand As New MySqlCommand()
.CommandText = "INSERT INTO tablebirds (`AOU_NUMBER`,`BIRDNAME`) values (@AOU_NUMBER,@BIRDNAME)"
.Connection = SQLConnection
.CommandType = CommandType.Text
Catch ex As MySqlException
End Try End Using
Jul 29, 2015 01:03 PM|Weibo Zhang|LINK
Thank you for your posting.
As a supplement, if you want to achieve your need with C#, you could refer to the following articles, they provide a detailed tutorials and a demo in vb.net and C#.
If you want to get the return values form stored procedure, the following link you could take a look. It explains how to use MySql Stored Procedures IN, OUT, and INOUT parameters in C# code.
Besides, the following links provide a CRUD demo about MySql. I think it may be useful to you.
I hope it’s useful to you.