C#.Net program to create a table in MySql database dynamically
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 create a table in the MySql database dynamically 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 MySql database using MySqlConnection class and then create the "employee" table in the database using ExecuteNonQuery() method of MySqlCommand class and print the "Table employee created successfully" message on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer