TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Poe Fernando
NA
8
414
Cannot test connection to mysql
Jun 6 2019 11:08 PM
Error message: "Unable to connect to any specified MySQL hosts" when i click on btn_Test. Im definitely entering a valid serverName and DatabaseName.
public
partial
class
MainForm : Form
{
public
static
string
serverName;
public
static
string
database;
public
MainForm()
{
InitializeComponent();
}
MySqlConnection connection =
new
MySqlConnection(
"server="
+ serverName +
"; Database="
+ database +
"; username=username; password=password"
);
public
void
btnTest_Click(
object
sender, EventArgs e)
{
serverName = txtServer.Text;
database = txtDatabase.Text;
try
{
connection.Open();
MessageBox.Show(
"Connected!"
);
}
catch
(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Reply
Answers (
1
)
How to Add Submenue to a menue
Retry logic on servers either in c# or cpp