Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Task - Writing Connection Strings | Introduction to Databases with .NET
Introduction to .NET with C#

Task - Writing Connection StringsTask - Writing Connection Strings

Your task is to write the connection string to connect to a MySql server. The server details are given below.

Note

The following details do not point to a real server, so it is not necessary to run the code. This task tests your ability to write a connection string. You can confirm your code's correctness by looking at the provided solution.

IP Address: 123.456.0.7
Port: 7779
User: root
Password: root123

Also, fill in the two blanks with the appropriate type/class name.

cs

index.cs

1. In the MySQL connection string we write the attribute-value pairs according to the attribute=value syntax. The pairs are separated by the semicolon (;) character.
2. We use the MySqlConnection class to create a connection object.
using System;
using MySql.Data.MySqlClient;

class Program
{
    static void Main(string[] args)
    {
        // Write code below this line
        string connectionString = "server=123.456.0.7;port=7779;user=root;password=root123;";
        MySqlConnection connection = new MySqlConnection(connectionString);
        // Write code above this line
    }
}

Все було зрозуміло?

Секція 3. Розділ 5
course content

Зміст курсу

Introduction to .NET with C#

Task - Writing Connection StringsTask - Writing Connection Strings

Your task is to write the connection string to connect to a MySql server. The server details are given below.

Note

The following details do not point to a real server, so it is not necessary to run the code. This task tests your ability to write a connection string. You can confirm your code's correctness by looking at the provided solution.

IP Address: 123.456.0.7
Port: 7779
User: root
Password: root123

Also, fill in the two blanks with the appropriate type/class name.

cs

index.cs

1. In the MySQL connection string we write the attribute-value pairs according to the attribute=value syntax. The pairs are separated by the semicolon (;) character.
2. We use the MySqlConnection class to create a connection object.
using System;
using MySql.Data.MySqlClient;

class Program
{
    static void Main(string[] args)
    {
        // Write code below this line
        string connectionString = "server=123.456.0.7;port=7779;user=root;password=root123;";
        MySqlConnection connection = new MySqlConnection(connectionString);
        // Write code above this line
    }
}

Все було зрозуміло?

Секція 3. Розділ 5
some-alt