|
-
May 6th, 2009, 04:32 AM
#1
Thread Starter
Hyperactive Member
-
May 6th, 2009, 04:48 AM
#2
Fanatic Member
Re: Loading from a database - Too slow
Dear
i have finished many solution with access and excel database
but never spend 5 - 6 miniutes to load them
why dont you use datagridview,dataview, listbox or another control to load them into.
you can use displaymember properties for listbox or datagridview . let try and tell us your trouble . Dear
-
May 6th, 2009, 04:52 AM
#3
Thread Starter
Hyperactive Member
-
May 6th, 2009, 04:55 AM
#4
Hyperactive Member
Re: Loading from a database - Too slow
hey knxrb
why you are loading database in string array
you may use datatable for storing data or if you want array sort of thing use list of string it will be faster
or you may use displaymember and valuemember for directly load from database as @manhit45 also suggested
* If my post helped you, please Rate it
* If your problem is solved please also mark the thread resolved it is there in right top of page under thread tools
* Why Rating is useful
-
May 6th, 2009, 04:55 AM
#5
Fanatic Member
Re: Loading from a database - Too slow
Do you want to load a column database to combox
if so , i can help you.
-
May 6th, 2009, 04:57 AM
#6
Thread Starter
Hyperactive Member
-
May 6th, 2009, 05:05 AM
#7
Fanatic Member
Re: Loading from a database - Too slow
OK
Very easy , i am using sql, you only instead sql into OLE
Code:
Dim objDataAdapterPT As New SqlDataAdapter("SELECT * from Kho_PT ", objConnection)
Dim PTdataview as new dataview
Dim PT dataset as new dataset
objDataAdapterPT.Fill(PTdataset, "PT")
PTdataview = New DataView(PTdataset.Tables("PT"))
combox1.DataSource = PTdataview
combox1.DisplayMember = "STT"
Last edited by manhit45; May 6th, 2009 at 05:15 AM.
-
May 6th, 2009, 05:09 AM
#8
Thread Starter
Hyperactive Member
-
May 6th, 2009, 05:51 AM
#9
Thread Starter
Hyperactive Member
-
May 6th, 2009, 07:03 AM
#10
Re: Loading from a database - Too slow
Try this
vb.net Code:
Public Class Form1
Private Sub AutoCompleteCombo(ByVal MyCombo As ComboBox, ByVal KeyCodes As KeyEventArgs)
Dim strSearchText As String
Dim intIndex As Integer
Dim objFound As Object
Dim strFound As String
Dim strAddText As String
Select Case KeyCodes.KeyCode
Case Keys.Back, Keys.Left, Keys.Right, Keys.Up, Keys.Delete, Keys.Down
Return
End Select
strSearchText = MyCombo.Text
intIndex = MyCombo.FindString(strSearchText)
If intIndex >= 0 Then
objFound = MyCombo.Items(intIndex)
strFound = MyCombo.GetItemText(objFound)
strAddText = strFound.Substring(strSearchText.Length)
MyCombo.Text = strSearchText & strAddText
MyCombo.SelectionStart = strSearchText.Length
MyCombo.SelectionLength = strAddText.Length
End If
End Sub
Private Sub cboProductCode_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cboProductCode.KeyUp
AutoCompleteCombo(cboProductCode, e)
End Sub
End Class
-
May 6th, 2009, 07:23 AM
#11
Thread Starter
Hyperactive Member
-
May 17th, 2009, 10:11 PM
#12
Re: [RESOLVED] Loading from a database - Too slow
As for obtaining the data, you may be able to gain a performance increase if you adopt one of these options.
Note, they are structured for SQL, just re do as OleDb. My guess is that you can get away from a DataSet per se, and just use a DataTable, or, just a DataReader....
-
May 18th, 2009, 03:34 AM
#13
Thread Starter
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|