get faster execution of query in database

  • Thread starter Thread starter Houssem12
  • Start date Start date
H

Houssem12

Guest
Hi members

before it was fast so fast

For i = 0 To DataGridView1.Rows.Count - 1

Try


Dim kk As New SqlCommand("select cbMarq,AR_Ref from F_DOCLIGNE where AR_Ref like '%" & DataGridView1.Rows(i).Cells(1).Value & "%' and DO_Piece='" & DataGridView1.Rows(i).Cells(0).Value & "'", cn)

Dim qq As New SqlDataAdapter(kk)
qq.Fill(qqs)

MsgBox("Numero cbMarq =" & qqs.Rows(i).Item("cbMarq") & " numero darticle " & qqs.Rows(i).Item(1))
Catch ex As Exception

End Try
Using cmd1 As New SqlCommand("insert into DetailReceptionFrs(Annee,Numero,Codearticle,Numseq,Designation,Qte,PrixUnitaire,PrixRevient,Remise,ReferenceFournisseur,NumeroLigneCommandeFrs,NumeroEnsemble,Marge,Coefficient1,Coefficient2)values ('0',@Numero,@Codearticle,@Numseq,@Designation,@Qte,@PrixUnitaire,@PrixRevient,@Remise,@ReferenceFournisseur,@NumeroLigneCommandeFrs,@NumeroEnsemble,@Marge,@Coefficient1,@Coefficient2)", cn)
With cmd1.Parameters
.Add("@Numero", SqlDbType.NVarChar).Value = (TextBox1.Text)
.Add("@Codearticle", SqlDbType.NVarChar).Value = (DataGridView1.Rows(i).Cells(1).Value)
MsgBox("Numero cbMarq =" & qqs.Rows(i).Item("cbMarq") & " numero darticle " & qqs.Rows(i).Item(1))
.Add("@Numseq", SqlDbType.NVarChar).Value = qqs.Rows(i).Item("cbMarq")
.Add("@Designation", SqlDbType.NVarChar).Value = (DataGridView1.Rows(i).Cells(2).Value)
.Add("@Qte", SqlDbType.NVarChar).Value = (DataGridView1.Rows(i).Cells(3).Value)
.Add("@PrixUnitaire", SqlDbType.NVarChar).Value = (DataGridView1.Rows(i).Cells(4).Value)
.Add("@PrixRevient", SqlDbType.NVarChar).Value = ("0.00")
.Add("@Remise", SqlDbType.NVarChar).Value = ("0.00")
.Add("@ReferenceFournisseur", SqlDbType.NVarChar).Value = (TextBox3.Text)
.Add("@NumeroLigneCommandeFrs", SqlDbType.Int).Value = 0

.Add("@NumeroEnsemble", SqlDbType.NVarChar).Value = (DataGridView1.Rows(i).Cells(7).Value)
.Add("@Marge", SqlDbType.NVarChar).Value = (DataGridView1.Rows(i).Cells(8).Value)
.Add("@Coefficient1", SqlDbType.NVarChar).Value = ("0.000")
.Add("@Coefficient2", SqlDbType.NVarChar).Value = ("0.000")



End With

was just an id, and when i changed to take value from another table it get very slower

because i want used it to manipulate data from this table with other table so i forced to make this manipulation

if need any idea how i think of this i will add it

just for now i have a select query wich will be inserted to another table that being so slow

Continue reading...
 
Back
Top