i have a webpage with a lot of txtboxes and i whant the value that is in that txtboxes to be inserted in a database the problem is that they worked with a ODBC driver first to insert in a other database but now i whanne edit it in SQL server the only problem is that i have this connection to insert it now but i dont realy know what i need 2 edit in the code
this is the original code from it
Expand|Select|Wrap|Line Numbers
- private void Opslaan()
- {
- localhost1.dbConnection dbConn = new localhost1.dbConnection();
- string Klant = ddlKlant.SelectedItem.Text;
- string Leverancier = ddlLeverancier.SelectedItem.Text;
- txtRef.Text = GenReferentieNr(txtRef.Text);
- if (imgBtnVerzamelSave.Visible == true)
- dbConn.AddVerzamelblad(Functions.DateToUS(txtDatum.Text), txtRef.Text, Leverancier, txtTAV.Text, txtLevFax.Text, Klant, txtContact.Text, txtKlantFax.Text, txtDebetNr.Text, (txtOmschrijving.Text).Replace("'","`"), (txtAantal1.Text).Replace("'","`"), (txtArtikel1.Text).Replace("'","`"), (txtBestelNr1.Text).Replace("'","`"), txtOnzePrijs1.Text, txtPrijsKlant1.Text, (txtLevTijd1.Text).Replace("'","`"), txtAantal2.Text, (txtArtikel2.Text).Replace("'","`"), (txtBestelNr2.Text).Replace("'","`"), txtOnzePrijs2.Text, txtPrijsKlant2.Text, (txtLevTijd2.Text).Replace("'","`"), txtAantal3.Text, (txtArtikel3.Text).Replace("'","`"), (txtBestelNr3.Text).Replace("'","`"), txtOnzePrijs3.Text, txtPrijsKlant3.Text, (txtLevTijd3.Text).Replace("'","`"), txtAantal4.Text, (txtArtikel4.Text).Replace("'","`"), (txtBestelNr4.Text).Replace("'","`"), txtOnzePrijs4.Text, txtPrijsKlant4.Text, (txtLevTijd4.Text).Replace("'","`"), txtAantal5.Text, (txtArtikel5.Text).Replace("'","`"), (txtBestelNr5.Text).Replace("'","`"), txtOnzePrijs5.Text, txtPrijsKlant5.Text, (txtLevTijd5.Text).Replace("'","`"), txtAantal6.Text, (txtArtikel6.Text).Replace("'","`"), (txtBestelNr6.Text).Replace("'","`"), txtOnzePrijs6.Text, txtPrijsKlant6.Text, (txtLevTijd6.Text).Replace("'","`"), txtAantal7.Text, (txtArtikel7.Text).Replace("'","`"), (txtBestelNr7.Text).Replace("'","`"), txtOnzePrijs7.Text, txtPrijsKlant7.Text, (txtLevTijd7.Text).Replace("'","`"), txtAantal8.Text, (txtArtikel8.Text).Replace("'","`"), (txtBestelNr8.Text).Replace("'","`"), txtOnzePrijs8.Text, txtPrijsKlant8.Text, (txtLevTijd8.Text).Replace("'","`"), txtAantal9.Text, (txtArtikel9.Text).Replace("'","`"), (txtBestelNr9.Text).Replace("'","`"), txtOnzePrijs9.Text, txtPrijsKlant9.Text, (txtLevTijd10.Text).Replace("'","`"), txtAantal10.Text, (txtArtikel10.Text).Replace("'","`"), (txtBestelNr10.Text).Replace("'","`"), txtOnzePrijs10.Text, txtPrijsKlant10.Text, (txtLevTijd10.Text).Replace("'","`"), txtWinst.Text, "0", true);
- else
- dbConn.AddVerzamelblad(Functions.DateToUS(txtDatum.Text), txtRef.Text, Leverancier, txtTAV.Text, txtLevFax.Text, Klant, txtContact.Text, txtKlantFax.Text, txtDebetNr.Text, (txtOmschrijving.Text).Replace("'","`"), (txtAantal1.Text).Replace("'","`"), (txtArtikel1.Text).Replace("'","`"), (txtBestelNr1.Text).Replace("'","`"), txtOnzePrijs1.Text, txtPrijsKlant1.Text, (txtLevTijd1.Text).Replace("'","`"), txtAantal2.Text, (txtArtikel2.Text).Replace("'","`"), (txtBestelNr2.Text).Replace("'","`"), txtOnzePrijs2.Text, txtPrijsKlant2.Text, (txtLevTijd2.Text).Replace("'","`"), txtAantal3.Text, (txtArtikel3.Text).Replace("'","`"), (txtBestelNr3.Text).Replace("'","`"), txtOnzePrijs3.Text, txtPrijsKlant3.Text, (txtLevTijd3.Text).Replace("'","`"), txtAantal4.Text, (txtArtikel4.Text).Replace("'","`"), (txtBestelNr4.Text).Replace("'","`"), txtOnzePrijs4.Text, txtPrijsKlant4.Text, (txtLevTijd4.Text).Replace("'","`"), txtAantal5.Text, (txtArtikel5.Text).Replace("'","`"), (txtBestelNr5.Text).Replace("'","`"), txtOnzePrijs5.Text, txtPrijsKlant5.Text, (txtLevTijd5.Text).Replace("'","`"), txtAantal6.Text, (txtArtikel6.Text).Replace("'","`"), (txtBestelNr6.Text).Replace("'","`"), txtOnzePrijs6.Text, txtPrijsKlant6.Text, (txtLevTijd6.Text).Replace("'","`"), txtAantal7.Text, (txtArtikel7.Text).Replace("'","`"), (txtBestelNr7.Text).Replace("'","`"), txtOnzePrijs7.Text, txtPrijsKlant7.Text, (txtLevTijd7.Text).Replace("'","`"), txtAantal8.Text, (txtArtikel8.Text).Replace("'","`"), (txtBestelNr8.Text).Replace("'","`"), txtOnzePrijs8.Text, txtPrijsKlant8.Text, (txtLevTijd8.Text).Replace("'","`"), txtAantal9.Text, (txtArtikel9.Text).Replace("'","`"), (txtBestelNr9.Text).Replace("'","`"), txtOnzePrijs9.Text, txtPrijsKlant9.Text, (txtLevTijd10.Text).Replace("'","`"), txtAantal10.Text, (txtArtikel10.Text).Replace("'","`"), (txtBestelNr10.Text).Replace("'","`"), txtOnzePrijs10.Text, txtPrijsKlant10.Text, (txtLevTijd10.Text).Replace("'","`"), txtWinst.Text, lblNoteID.Text, false);
- }
Expand|Select|Wrap|Line Numbers
- private void Opslaan()
- {
- localhost1.dbConnection dbConn = new localhost1.dbConnection();
- string Klant = ddlKlant.SelectedItem.Text;
- string Leverancier = ddlLeverancier.SelectedItem.Text;
- txtRef.Text = GenReferentieNr(txtRef.Text);
- if (imgBtnVerzamelSave.Visible == true)
- cmd.CommandText = "insert into verzamelblad values('" + txtRef + "','" + Leverancier + "','" + txtTAV + "','" + txtLevFax + "','" + Klant + "','" + txtContact + "','" + txtKlantFax + "','" + txtDebetNr + "','" + txtOmschrijving + "','" + txtAantal + "','" + txtArtikel1 + "','" + txtBestelnr1 + "','" + txtOnzePrijs1 + "','" + txtPrijsKlant1 + "','" + txtLevTijd1 + "','" + txtArtikel2 + "','" + txtBestelnr2 + "','" + txtOnzePrijs2 + "','" + txtPrijsKlant2 + "','" + txtLevTijd2 + "','" + txtArtikel3 + "','" + txtBestelnr3 + "','" + txtOnzePrijs3 + "','" + txtPrijsKlant3 + "','" + txtLevTijd3 + "','" + txtArtikel4 + "','" + txtBestelnr4 + "','" + txtOnzePrijs4 + "','" + txtPrijsKlant4 + "','" + txtLevTijd4 + "','" + txtArtikel5 + "','" + txtBestelnr5 + "','" + txtOnzePrijs5 + "','" + txtPrijsKlant5 + "','" + txtLevTijd5 + "','" + txtArtikel6 + "','" + txtBestelnr6 + "','" + txtOnzePrijs6 + "','" + txtPrijsKlant6 + "','" + txtLevTijd6 + "','" + txtArtikel7 + "','" + txtBestelnr7 + "','" + txtOnzePrijs7 + "','" + txtPrijsKlant7 + "','" + txtLevTijd7 + "','" + txtArtikel8 + "','" + txtBestelnr8 + "','" + txtOnzePrijs8 + "','" + txtPrijsKlant8 + "','" + txtLevTijd8 + "','" + txtArtikel9 + "','" + txtBestelnr9 + "','" + txtOnzePrijs9 + "','" + txtPrijsKlant9 + "','" + txtLevTijd9 + "','" + txtArtikel10 + "','" + txtBestelnr10 + "','" + txtOnzePrijs10 + "','" + txtPrijsKlant10 + "','" + txtLevTijd10 + "')";
- else
- cmd.CommandText = "insert into verzamelblad values('" + txtRef + "','" + Leverancier + "','" + txtTAV + "','" + txtLevFax + "','" + Klant + "','" + txtContact + "','" + txtKlantFax + "','" + txtDebetNr + "','" + txtOmschrijving + "','" + txtAantal + "','" + txtArtikel1 + "','" + txtBestelnr1 + "','" + txtOnzePrijs1 + "','" + txtPrijsKlant1 + "','" + txtLevTijd1 + "','" + txtArtikel2 + "','" + txtBestelnr2 + "','" + txtOnzePrijs2 + "','" + txtPrijsKlant2 + "','" + txtLevTijd2 + "','" + txtArtikel3 + "','" + txtBestelnr3 + "','" + txtOnzePrijs3 + "','" + txtPrijsKlant3 + "','" + txtLevTijd3 + "','" + txtArtikel4 + "','" + txtBestelnr4 + "','" + txtOnzePrijs4 + "','" + txtPrijsKlant4 + "','" + txtLevTijd4 + "','" + txtArtikel5 + "','" + txtBestelnr5 + "','" + txtOnzePrijs5 + "','" + txtPrijsKlant5 + "','" + txtLevTijd5 + "','" + txtArtikel6 + "','" + txtBestelnr6 + "','" + txtOnzePrijs6 + "','" + txtPrijsKlant6 + "','" + txtLevTijd6 + "','" + txtArtikel7 + "','" + txtBestelnr7 + "','" + txtOnzePrijs7 + "','" + txtPrijsKlant7 + "','" + txtLevTijd7 + "','" + txtArtikel8 + "','" + txtBestelnr8 + "','" + txtOnzePrijs8 + "','" + txtPrijsKlant8 + "','" + txtLevTijd8 + "','" + txtArtikel9 + "','" + txtBestelnr9 + "','" + txtOnzePrijs9 + "','" + txtPrijsKlant9 + "','" + txtLevTijd9 + "','" + txtArtikel10 + "','" + txtBestelnr10 + "','" + txtOnzePrijs10 + "','" + txtPrijsKlant10 + "','" + txtLevTijd10 + "')";
- cmd.ExecuteNonQuery();
- conn.Close();
- }
there maybe some misctacks made in the txtbox nameing but i am sure i can solve that my self if somone would be kind enouf to solve the connection i can do the rest my self i think
Tnx