0
I have this code snippet where it takes the information from a database field and goes to textBlock, but now I need to fill in some textblock.
EX: In the database has name=maria Rg=123 Cpf=456 ai in the program goes have the textblock that will take name, Rg, Cpf.
Code:
using (_connection = new MySqlConnection("Database=test;Data Source=localhost;User Id=root;Password=teste;SslMode=None;"))
{
System.Text.EncodingProvider ppp;
ppp = System.Text.CodePagesEncodingProvider.Instance;
Encoding.RegisterProvider(ppp);
_connection.Open();
var cmd = new MySqlCommand("select name from user where id=1", _connection);
using (var reader = cmd.ExecuteReader())
{
if (reader.Read())
{
textBlock.Text = (reader.GetString("name"));
}
}
}
you that put more these fields ? in query and textBlock
– Marco Souza
I have in the database the name field that is assumed by textblock 1. I now added the fields Rg and CPF in the database and I want it to be assumed by textblock 2 and 3.
– South92