(
Deutsche Version) Setting up an SQL server is pretty simple, there is a lot of free software (e.g. MySQL) which is not difficult to setup. I assume that you are familiar with SQL and you know what you want to send and receive from the server. To access the server via C# you have to execute the following code:
string server = "serverName";
string database = "databaseName;
string uid = "userName";
string password = "password;
string table = "tableName;
string connectionString = "SERVER=" + server + ";" + "DATABASE=" +
database + ";" + "UID=" + uid + ";" + "PASSWORD=" + password + ";";
MySqlConnection connection = new MySqlConnection(connectionString);
connection.Open();
string query = "some SQL query";
MySqlCommand cmd = new MySqlCommand(query, connection);
try
{
cmd.ExecuteNonQuery();
}
catch (Exception)
{}
No comments:
Post a Comment