It became interesting, is it possible to connect mysql to Visual Studio so that without going into the browser to send data? For example, I am writing an article, I want to post it on a site, but for example, if a site without an admin panel, go to the hosting for a long time, and from there to phpmyadmin. Is it possible to connect the form to mysql and send data directly from it? Thanks in advance to everyone!

  • Window Server Explorer did not try to open? - Bulson
  • 2
    You will need to install an adapter for .NET, by default the studio can work only with MS products. And then like with any other database - rdorn

1 answer 1

I see 2 options:

  1. Put the adapter to work with a database that is not MSSQL

  2. Write a simple PHP script that will catch your post / get requests and interact with the database. Sort of

     $servername = "localhost"; $dbname = "_arealitydb"; $username = "root"; $password = ""; $queryDebug = false; // Create connection $conn = mysqli_connect($servername, $username, $password, $dbname); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } function queryExec($query) { if ( $GLOBALS["queryDebug"]) { echo $query + "<br>"; } $conn = $GLOBALS["conn"]; $sql = $query; $result = mysqli_query($conn, $sql) or die(mysqli_error($conn)); if (!$result) { die('Could not query:' . mysql_error()); } return $result; } function getFirstCellValueFromQuery($query) { return queryExec($query) -> fetch_array()[0]; } function printJsonFromQuery($query) { $result = queryExec($query); $rows = array(); while($r = mysqli_fetch_assoc($result)) { $rows[] = $r; } print json_encode($rows); } 

to interact with the database

and something like:

 if ( isset($_GET['queryToExecute']) ) { $query = $_GET['queryToExecute']; queryExec($query); } 

Well, then just make a request for a page with a parameter

http://localhost/sqlExecutor.php?queryToExecute=SomeQueryText

The first option is better, but the second one will also work.