skip to Main Content

MySqlConnector – Parameter in dynamic string query won't be set

@pname is the parameter set in C# code by: using (MySqlCommand dynamicQueryCommand = new MySqlCommand(dynamicQueryWithParameter, conn)) { dynamicQueryCommand.Parameters.Add("@pName", MySqlDbType.String); dynamicQueryCommand.Parameters["@pName"].Value = "John"; using (MySqlDataReader dynamicQueryReader = dynamicQueryCommand.ExecuteReader()) { string output = ""; object[] values = new object[dynamicQueryReader.FieldCount]; while (dynamicQueryReader.Read()) {…

VIEW QUESTION

"readDefaultFile" connection property is not working when used in C++ code using mysql-connector-c++-8.0.33

I am using mysql-connector-c++-8.0.33 and C++ code to connect to database. Here is the code, try { sql::Driver *driver; sql::Connection *con; sql::Statement *stmt; sql::ResultSet *res; sql::ConnectOptionsMap connection_properties; driver = get_driver_instance(); connection_properties["hostName"] = "localhost"; connection_properties["userName"] = "correctusername"; connection_properties["password"] = "correctpassword"; connection_properties["schema"]…

VIEW QUESTION

How to fix java.lang.ClassNotFoundException: com.mysql.jdbc.Driver?

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; public class App { public static void main(String[] args) { App pro = new App(); pro.createConnection(); } void createConnection(){ try{ Class.forName("com.mysql.cj.jdbc.Drive"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb", "root","root"); System.out.print("testinggg"); }catch(ClassNotFoundException…

VIEW QUESTION

Python function to insert into MySQL

I cannot see why my defined function does not work. No error message, just no INSERT into the Table... after much help from the community, here is an edit of the intial question with more info: EDIT --------------- TEST 1…

VIEW QUESTION

Python insert intoMySQL

I cannot see why my defined function does not work. No error message, just no INSERT into the Table I define my function: import mysql.connector db = mysql.connector.connect(host="localhost", user="root", passwd="", database="autot") mycursor = db.cursor() def writedb(Tablename,Time, trade_ID, Price, Quantity): mycursor.execute("INSERT…

VIEW QUESTION
Back To Top
Search