F
F.oliveirarocha
Guest
Hi Folks,
I'm a new user in Programming in C#, so I need your help please.
I have a textBox1 that has a ID to filter and show the line in a DataGridView, I tried with wizard and all textboxes are working, not the DataGridView. What's wrong?
The parameter to filter is not working and I don't know how to fix it. Please help me with that.
Error message: "Falha na Leitura dos Dados na Tabela! Incorrect syntax near 'Cod_Numero_Parcelas_a_Pagar' .
here follows the code:
Thanks and best regards.
private void btn_filtrar_Click(object sender, EventArgs e)
{
int numeroparcela = Convert.ToInt32(textBox1.Text);
this.numero_Parcelas_a_PagarTableAdapter.FillFiltroParcela(this.numeroParcelasaPagarUpdate.Numero_Parcelas_a_Pagar, numeroparcela);
string constr = @"Data Source=DESKTOP-3O98051;Initial Catalog=SGFRenaissance;Integrated Security=True";
using (SqlConnection conn = new SqlConnection(constr))
{
string Busca = "SELECT Cod_Numero_Parcelas_a_Pagar, Cod_Entrada_Titulos_a_Pagar, Numero_Parcela, Data_Vencimento, Valor_Parcela, Historico, Cod_Status_Titulo"
+ "FROM Numero_Parcelas_a_Pagar"
+ "WHERE(Cod_Numero_Parcelas_a_Pagar LIKE @numeroparcela)";
DataTable DT = new DataTable();
try
{
conn.Open();
if(conn.State == ConnectionState.Open)
{
objAdapter = new SqlDataAdapter(Busca, conn);
objAdapter.Fill(DT);
numero_Parcelas_a_PagarDataGridView.DataSource = DT;
}
else
{
MessageBox.Show("Falha na Abertura da Conexão ao Banco de Dados!", "Erro!");
}
}
catch (Exception Ex)
{
MessageBox.Show("Falha na Leitura dos Dados na Tabela! " + Ex.Message);
}
finally
{
conn.Close();
}
}
}
Continue reading...
I'm a new user in Programming in C#, so I need your help please.
I have a textBox1 that has a ID to filter and show the line in a DataGridView, I tried with wizard and all textboxes are working, not the DataGridView. What's wrong?
The parameter to filter is not working and I don't know how to fix it. Please help me with that.
Error message: "Falha na Leitura dos Dados na Tabela! Incorrect syntax near 'Cod_Numero_Parcelas_a_Pagar' .
here follows the code:
Thanks and best regards.
private void btn_filtrar_Click(object sender, EventArgs e)
{
int numeroparcela = Convert.ToInt32(textBox1.Text);
this.numero_Parcelas_a_PagarTableAdapter.FillFiltroParcela(this.numeroParcelasaPagarUpdate.Numero_Parcelas_a_Pagar, numeroparcela);
string constr = @"Data Source=DESKTOP-3O98051;Initial Catalog=SGFRenaissance;Integrated Security=True";
using (SqlConnection conn = new SqlConnection(constr))
{
string Busca = "SELECT Cod_Numero_Parcelas_a_Pagar, Cod_Entrada_Titulos_a_Pagar, Numero_Parcela, Data_Vencimento, Valor_Parcela, Historico, Cod_Status_Titulo"
+ "FROM Numero_Parcelas_a_Pagar"
+ "WHERE(Cod_Numero_Parcelas_a_Pagar LIKE @numeroparcela)";
DataTable DT = new DataTable();
try
{
conn.Open();
if(conn.State == ConnectionState.Open)
{
objAdapter = new SqlDataAdapter(Busca, conn);
objAdapter.Fill(DT);
numero_Parcelas_a_PagarDataGridView.DataSource = DT;
}
else
{
MessageBox.Show("Falha na Abertura da Conexão ao Banco de Dados!", "Erro!");
}
}
catch (Exception Ex)
{
MessageBox.Show("Falha na Leitura dos Dados na Tabela! " + Ex.Message);
}
finally
{
conn.Close();
}
}
}
Continue reading...