Hi There;
I am learning how to establish a connection to mysql in c#. Here are my codes :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySql.Data.MySqlClient;
public partial class _06_web_form_elemanlari_08_button : System.Web.UI.Page
{
protected void connect(Object Sender, CommandEventArgs arguman)
{
try
{
MySqlConnection connection; // bağlantı nesmenizi tanımladık
string connString;
MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder(); //" MySqlConnectionStringBuilder" bize bağlantı kurmamızı kolaylaştıran yapı
builder.UserID = "root";
builder.Password = "123456";
builder.Database = "connectcsharptomysql";
builder.Server = "localhost";
connString = builder.ToString();
connection = new MySqlConnection(connString);
connection.Open();
Response.Write("Connection is successfull.");
connection.Close();
}
catch (Exception ex)
{
Response.Write("Bağlantı başarılı DEĞİL.");
Response.Write(ex.Message);
}
}
}
When I run this code : I catched this error: "Keyword not supported. Parameter name: MySql.Data.MySqlClient.MySqlConnectionStringBuilder"
Is there any ideas to solve this problem? Thanks in advance.