I'm doing an application in C # in Windows 10 ran normal but I need to put in a machine with Windows XP plus I'm having problems connecting the database in Mysql the version is with framework 4.0 the connection is right dripping with the ip of the bank someone knows to tell me what can be, follow the code below.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace ValidaGrupo
{
public partial class Form1 : Form
{
Boolean encerrar = false;
MySqlConnection conexao = new MySqlConnection("server=localhost; Port=3306; userid=root; pwd=root; database=prom");
MySqlCommand command;
MySqlDataReader mdr;
string text = System.IO.File.ReadAllText(@"C:\V2SWS\getserial.log");
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Activate();
string serial = Convert.ToString(text.Substring(2));
txtSerial.Text = serial;
//MessageBox.Show(serial);
conexao.Open();
var sql = "select grupo,familia from prom.order_sn a inner join k2config.tabmopeso b on a.order_num = b.order_num where uwip_barcode = '" + txtSerial.Text + "'";
command = new MySqlCommand(sql, conexao);
MySqlDataReader dr = command.ExecuteReader();
if (dr.Read())
{
txtGrupo.Text = dr.GetString("grupo");
txtFamily.Text = dr.GetString("familia");
txtResult.Select();
}
conexao.Close();
}
private void txtResult_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
if (txtResult.Text != txtGrupo.Text)
{
lbError.Visible = true;
txtResult.Text = "";
}
else if(txtFamily.Text == "T46S" || txtFamily.Text == "T470" || txtFamily.Text == "T480")
{
txtResult.Visible = false;
lbError.Visible = false;
lbAviso.Visible = true;
txtKit.Visible = true;
txtKit.Select();
}
else
{
encerrar = true;
Application.Exit();
}
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (encerrar == false)
{
e.Cancel = true;
}
}
private void txtKit_KeyPress(object sender, KeyPressEventArgs e)
{
if ((Keys)e.KeyChar == Keys.Enter)
{
if (txtResult.Text != txtKit.Text)
{
lbError.Visible = true;
lbAviso.Visible = false;
txtKit.Text = "";
}
else
{
encerrar = true;
Application.Exit();
}
}
}
}
}