0

I have an activation system at my application.

When user enter the key it log in to online host Mysql database and check if key exist to activate. This is going really slow 2 min per key. Is there any way for faster check and activation ?

Code :

For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
            If ds.Tables(0).Rows(i).Item(1).ToString = TextBox1.Text And ds.Tables(0).Rows(i).Item(2).ToString = "no" Then
                Dim sqlquery1 = "UPDATE tablename SET used = 'Yes' WHERE id = '" & CInt(ds.Tables(0).Rows(i).Item(0).ToString) & "'"

If you need more code just let me know ill copy entire code

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
1337user
  • 7
  • 1
  • 10
  • 3
    I would be more concerned with the open door to Sql Injection. – Steve Nov 16 '14 at 16:46
  • @Steve you mean this ? `mysqlconnection3.ConnectionString = "server=; Port=2083; user id=; password=; database=" mysqlconnection3.Open()` – 1337user Nov 16 '14 at 17:17
  • Nope, read about Sql Injection [here](http://stackoverflow.com/questions/332365/how-does-the-sql-injection-from-the-bobby-tables-xkcd-comic-work) or more formally [here](http://en.wikipedia.org/wiki/SQL_injection) – Steve Nov 16 '14 at 17:19
  • How many rows are in `ds.Tables(0)`? – Steve Nov 17 '14 at 21:11
  • Why not specify the table, instead of going through the entire dataset? ds?? even create a store procedure to load the query and other for the update? – ger Nov 26 '18 at 17:17

0 Answers0