1
I would like to know if it is possible and how to perform an INSERT in the database of 10 equal values and adding 1 more in a field..
ex: I have an equity system and I need to register 10 identical items. when marking a checkbox and adding the amount of items in a textbox he adds the 10 items to the database...
need that when recording is add +1 to the number of the platelet that is will be a random number typed..
ex:
txtPlaqueta.Text = "123"
CheckBox = true;
txtValorRepetir = "10"
then I’d be in the comics like this
123,124,125,126,127,128,129,130,131,132
if I change the platelet number to "50" it would be in the comic
50,51,52,53,54,55,56,57,58,59
private void btAdd_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(//string de conexao);
txtValor.Text = (int.Parse(txtValor.Text) + 1).ToString();
string inserir = @"INSERT INTO DadosNome (Nome, Valor, Teste, Deletar) Values ('"+txtNome.Text+"', '"+txtValor.Text+"', '"+txtTeste.Text+"', '"+txtDeletar.Text+ "'),('" + txtNome.Text + "', '" + txtValor.Text + "', '" + txtTeste.Text + "', '" + txtDeletar.Text + "')";
SqlCommand cmd = new SqlCommand(inserir, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
Assuming that the value column has value "22" when making the Index it would be (22,23,24,25) four records in the bd.
just make a loop... but put the code you use to make a link
– Rovann Linhalis
Could you show me some code, so I know this loop.
– dionebravo