'Keyword not supported error' Using Dot Connect and MySQL.
Posted by: Anthony Chavez
Date: August 18, 2017 12:30PM

Hello, I was trying to connect a MySQL database to a windows form and I received this error: System.ArgumentException: 'Keyword not supported: 'host'.'
I looked online and I'm not exactly sure how to fix it without going to app config files etc, and doing large scale changes. Does anybody have any experience with this error or any knowledge on how to remedy the situation? Here is a code snippet of what I'm working with, keep in mind I am just learning to work with databases.

using System;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace savetodatabasepractice
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}


private void button1_Click(object sender, EventArgs e)
{
using (SqlConnection conn = new SqlConnection())
{
conn.ConnectionString = "User Id=XXXXXX;Host=localhost;Database=XXXXXX";
SqlCommand insertCommand = new SqlCommand("INSERT INTO tbl_newdata (ID, Temperature, Humidity) VALUES (1, 72, 34)", conn);
}
}
}
}

Thanks again for any help or insight!

Options: ReplyQuote


Subject
Written By
Posted
'Keyword not supported error' Using Dot Connect and MySQL.
August 18, 2017 12:30PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.