C#.Net program to get the MySQL version using the \'Select\' statement
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Program:
The source code to get the MySQL version using the "Select" statement is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we imported a namespace MySql.Data.MySqlClient to establish the connection with the MySQL database. Then we created a class Program that contains the Main() method.
The Main() method is the entry point for the program. In the Main() method, we created a connection string variable ConnString that contains the database connectivity credentials. After that we established the connection to the database using MySqlConnection class and then get the MySql version using ExecuteScalar() method of MySqlCommand class and print the result on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer