T
T Perkins
no matter how i code it, there is always 3-5 second pause on retrieving data
from an sql 2000 server. this pause only happens on the first try, after
that every access is back to being normal. is there a known issue with this
or am i doing something dumb?
im using the following code:
what im attepting to do is when a user exits a combo box, the app retrieves
the highest id, then adds 1 and displays it
the problem is that if the users selects a media that has 5000 plus records
the first time around it takes almost 5 seconds before a number is found.
the first time i saw this i thought it locked up
Private Sub cmbMedia_OnLeave(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmbMedia.Leave
cmd.CommandText = "SELECT MAX(id) FROM inventory WHERE media = '" & media &
"'"
cmd.Connection = conn.GetSqlConnection
dr = cmd.ExecuteReader
dr.Read()
If dr.IsDBNull(0) = False Then
Me.txtId_num.Text = dr(0).GetSqlInt16 + 1
Else
MessageBox.Show("There are no items that match the media type",
"Warning...", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
dr.close()
End sub
thanks in advance
tony
from an sql 2000 server. this pause only happens on the first try, after
that every access is back to being normal. is there a known issue with this
or am i doing something dumb?
im using the following code:
what im attepting to do is when a user exits a combo box, the app retrieves
the highest id, then adds 1 and displays it
the problem is that if the users selects a media that has 5000 plus records
the first time around it takes almost 5 seconds before a number is found.
the first time i saw this i thought it locked up
Private Sub cmbMedia_OnLeave(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmbMedia.Leave
cmd.CommandText = "SELECT MAX(id) FROM inventory WHERE media = '" & media &
"'"
cmd.Connection = conn.GetSqlConnection
dr = cmd.ExecuteReader
dr.Read()
If dr.IsDBNull(0) = False Then
Me.txtId_num.Text = dr(0).GetSqlInt16 + 1
Else
MessageBox.Show("There are no items that match the media type",
"Warning...", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
dr.close()
End sub
thanks in advance
tony