-2
I would like some help as I would like to know how I can get information from a Mysql database and that will be taken over by a textblock. could help me with the code that does this?
EX: In Database name = John the textblock will be john.
-2
I would like some help as I would like to know how I can get information from a Mysql database and that will be taken over by a textblock. could help me with the code that does this?
EX: In Database name = John the textblock will be john.
-1
Although this method of connection has been discontinued I will post an answer if it is useful
Download and install the following files (Win64):
https://cdn.mysql.com//Downloads/Mysql-5.5/mysql-5.5.54-winx64. msi
https://dev.mysql.com/get/Downloads/Connector-Net/mysql-connector-net-6.7.9.msi
To avoid mistakes of Encoding Exception
select:
Create a project UWP
and add a reference to C:\Program Files (x86)\MySQL\MySQL Connector Net 6.7.X\Assemblies\RT\MySql.Data.RT.dll
To connect and query your table data:
using (_connection = new MySqlConnection("Database=test;Data Source=localhost;User Id=root;Password=teste;SslMode=None;"))
{
_connection.Open();
var cmd = new MySqlCommand("select name from user where id=1", _connection);
using (var reader = cmd.ExecuteReader())
{
if (reader.Read())
{
TextBlockName.Text = (reader.GetString("name"));
}
}
}
Source: https://github.com/rubgithub/MySqlUWP
References:
https://dev.mysql.com/doc/connector-net/en/connector-net-rt.html
https://blogs.oracle.com/MySqlOnWindows/entry/how_to_using_connector_net
https://stackoverflow.com/questions/38785440/connecting-to-mysql-database-error-uwp-c
Browser other questions tagged c# visual-studio uwp
You are not signed in. Login or sign up in order to post.