|
Not really. Why are you using the TOP modifier in the SQL? You're not doing any ordering, so it looks like you're just using it to limit the results returned, which could be ANY 5000 of the record set returned constrained by the WHERE clause.
The biggest part of the problem may not be the records returned, but by the code running in InsertDBIndexData . If it's adding data to a sorted collection, the data will be added slower and slower as the size of the collection increases.
|
|
|
|
|
Thanks for your reply.
I'm not sorting anything, only adding it to a Lucene.Net indexing database. This is how the code looks:
Private Sub InsertDBIndexData(ByVal idbID As Integer, ByVal sCPR As String, ByVal sName As String, ByVal sCompany As String, ByVal sAddress As String, ByVal sStatus As String, ByVal sType As String)
'New person in the index
Dim writer As New Lucene.Net.Index.IndexWriter(DBIndexLocation, New StandardAnalyzer, False)
Dim doc As New Document
Dim f1 As New Field("dbID", idbID, Field.Store.YES, Field.Index.NO)
Dim f2 As New Field("CPR", sCPR, Field.Store.YES, Field.Index.TOKENIZED)
Dim f3 As New Field("Name", sName, Field.Store.YES, Field.Index.TOKENIZED)
Dim f4 As New Field("Company", sCompany, Field.Store.YES, Field.Index.TOKENIZED)
Dim f5 As New Field("Address", sAddress, Field.Store.YES, Field.Index.TOKENIZED)
Dim f6 As New Field("Status", sStatus, Field.Store.YES, Field.Index.NO)
Dim f7 As New Field("Type", sType, Field.Store.YES, Field.Index.NO)
doc.Add(f1)
doc.Add(f2)
doc.Add(f3)
doc.Add(f4)
doc.Add(f5)
doc.Add(f6)
doc.Add(f7)
writer.AddDocument(doc)
writer.Optimize()
writer.Close()
End Sub
Private Sub newIndex()
Dim odConnection As oleDbConnection = new oleDbConnection("......db.mdb")
odConnection.Open()
Dim writer As New Lucene.Net.Index.IndexWriter(DBIndexLocation, New StandardAnalyzer, True)
writer.Close()
odCommand = New OleDbCommand("select * from Customers", odConnection)
odReader = odCommand.ExecuteReader
While odReader.Read
'InsertDBIndexData(odReader("id"), odReader("cpr"), odReader("firstname") & " " & odReader("lastname"), odReader("legalname"))
InsertDBIndexData(odReader("persid").ToString, odReader("cpr").ToString, odReader("firstname").ToString & " " & odReader("lastname").ToString, odReader("legalname").ToString, odReader("address1").ToString, odReader("Status").ToString, odReader("InsType").ToString)
End While
odReader.Close()
End Sub
The only optimizing i can figure out here, is to only open the (Lucene.Net)writer once. And when i'm indexing it also takes up ALOT of resources. Is there any way i can limit that?
Would it be better to first drag everything out of the DB, place it in an ArrayList and when that's done, start moving it to the Lucene.Net index?
|
|
|
|
|
Jan Sommer wrote: writer.AddDocument(doc) writer.Optimize()
I get the feeling that this is where your code spends most of it's time. Just on these two lines. You can use the ANTS profiler, or CompuWare's, to find out how much time it takes to execute these instructions.
Jan Sommer wrote: And when i'm indexing it also takes up ALOT of resources. Is there any way i can limit that?
No, there isn't.
|
|
|
|
|
The writer.optimize() part certainly took alot of time. I removed it and placed it after the while odreader.read, and that saved me 1/3 of the time it took to index the db. But it still isn't fast enough.
Currently i'm indexing the DB and when i check the taskmanager it says something like:
Process: IndexService.exe, CPU: 00 (sometimes 01) and memory: between 100.000 and 800.000
Why is it taking up all the memory and not using the CPU?
The indexing program is soon going to run on a server with a bit more ram. I hope that will speed up things a little.
Will it be any faster if i somehow convinced the IT-department to switch to MSSQL?
|
|
|
|
|
We have a problem with outlook size limit and are not allowed to create pst. I can only copy those msg to a folder. Do you have any idea how to store this msg in access and create forms in access to view this msg.
|
|
|
|
|
Can I select a certain time such as 4:00PM on a particular date with a dateTime picker?
I only saw a date selection in the dateTime picker.
|
|
|
|
|
hi,
use following code to getTime.
MsgBox(DateTimePicker1.Value.TimeOfDay.ToString)
also if you want to display time with date in datetimepicker then change the "format" property of datetimepicker to "Custom" and custom property to MM/dd/yyyy hh mm tt
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Can I make it so that the time picker will only choose each hour or half hour.
|
|
|
|
|
hi,
i does not properly get you (Because of my poor english). Please told your problem in detail & simple way, so i can suggest you.
However you can show only time in DatetimePicker by change the CustomFormat property to "hh mm tt"
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
I need to create a time picker that only shows every hour on the hour such as 4:00 PM and 5:00 PM. I also want it to show each half hour such as 4:30 PM and 5:30 PM.
Does the time picker do this or does it only show by the minute such as 5:01 PM, 5:02 PM, etc.
|
|
|
|
|
hi,
i think you want to show Time in hour or Half hour format.
Change CustomFormat property to "hh 00" or "hh 30" according to conditon
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Can the date time picker do both date and time at the same time?
|
|
|
|
|
yes. you can .
use following for get date and time
msgbox DateTimePicker1.Value.ToString
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Hii
Thanks now i got the shapes present on the panel at runtime .
1 ) Now , the problem is , i am having some normal controls like Textbox,Rb,CBox,Checkbox,Grid ..which are generating at runtime on the panel(Runtime generated ).Now if if move the RectangleShape ,OValShape on those controls ( Textbox,Rb,CBox,Checkbox,DataGridview ..) Dark Lines scattering all over the control are appearing while Dragging from one place to another place (For this i used pickbox from codeproject for shapes ) on the panel .I have refresh my panel again .THis makes the Shape controls Flickering all the time .
2 ) If i create a control .like Textbox,Rb,CBox,Checkbox,Grid on the location of Shape control ,The boundaries of shape controls are appearing on the Control which is not good for looking . I want like at Visual Studio 2005 Design time .It has to go back of the control and doesnt show the boundaries of shapecontrol on normal control .
3) Its not in the smooth way like in Visual studio 2005 design time
Thanks ,
|
|
|
|
|
VB 8.0 wrote: 1 ) Now , the problem is , i am having some normal controls like Textbox,Rb,CBox,Checkbox,Grid ..which are generating at runtime on the panel(Runtime generated ).Now if if move the RectangleShape ,OValShape on those controls ( Textbox,Rb,CBox,Checkbox,DataGridview ..) Dark Lines scattering all over the control are appearing while Dragging from one place to another place (For this i used pickbox from codeproject for shapes ) on the panel .I have refresh my panel again .THis makes the Shape controls Flickering all the time
Yes. This is because you're not redrawing the controls that you're dragging the line over. Until those controls are redrawn, they'll look like garbage. The problem with doing this is that you will be redrawing a lot more stuff for each MouseMove event you get. This can cause even more flickering than you're dealing with now.
VB 8.0 wrote: 2 ) If i create a control .like Textbox,Rb,CBox,Checkbox,Grid on the location of Shape control ,The boundaries of shape controls are appearing on the Control which is not good for looking . I want like at Visual Studio 2005 Design time .It has to go back of the control and doesnt show the boundaries of shapecontrol on normal control .
I have no idea what you're talking about with this one. I'm guessing that you'll have to redraw the entire panel control, along with all of it's child controls again once the new control is added.
VB 8.0 wrote: 3) Its not in the smooth way like in Visual studio 2005 design time
Google for "Host Visual Studio Forms Designer". You may be surprised at what it takes to do what you want.
|
|
|
|
|
THanks ,
i used BringToFront ,SendToBack then it is working properly .
|
|
|
|
|
Hello everyone,
I need to draw a racetrack map using GPS data. Please kindly help or tell me where i can get help from?
Thanks a lot!
Much appreciated
Amar
|
|
|
|
|
Sounds like you need a lot of help. Why do you need to do this ? Have you accepted a job and now you're hoping we'll do it for you ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Wow, pretty tough response since he didn't ask anyone to write it...he just asked for help or direction.
Who cares why he needs it....and why do you assume the worst??? Such a cutting response to assume he accepted a job and now he's hoping you all will do it for you.
God I hope you aren't in Tech support....
Ken
|
|
|
|
|
If u look around on net you will find the structure of GPS packet. U need to split it and get the longitude and latitude out of it and then map these points on ur screen's map..
I think this is the best i can tel you for a generic question u has asked for
Good
Lock
|
|
|
|
|
Hey gang!
I need you help with some codes to validate user input in a form to capture hours worked each day. I want to make sure that a number is input and also that the value is less than 16. Please help. The below was an idea I had, but I dont know where to place code and implement.
Sub ValidateHours()
Dim StrHours As String
StrHours = txtMonday1.Text
StrHours = txtTuesday1.Text
StrHours = txtWednesday1.Text
StrHours = txtThursday1.Text
StrHours = txtFriday1.Text
StrHours = txtSaturday1.Text
StrHours = txtSunday1.Text
StrHours = txtCTOused1.Text
If IsNumeric(StrHours) And StrHours < 0 Or StrHours > 24 Then
MessageBox.Show("ok. good")
Else
MessageBox.Show("Hours worked must be at least 0 and no greater than 24")
End If
End Sub
|
|
|
|
|
|
I wanted to close the loop on this and document my decided solution for the benefit of the next newbie that asks this question on validation.
I dragged a errorprovider component from the Toolbox onto my form. Then I place the following code afte the "leave" event for each field:
'begin data type error trapping here
erpTimeSheet.SetError(txtMonday1, "")
erpTimeSheet.SetError(txtTuesday1, "")
erpTimeSheet.SetError(txtWednesday1, "")
erpTimeSheet.SetError(txtThursday1, "")
erpTimeSheet.SetError(txtFriday1, "")
erpTimeSheet.SetError(txtSaturday1, "")
erpTimeSheet.SetError(txtSunday1, "")
If Not IsNumeric(txtMonday1.Text) Then
erpTimeSheet.SetError((txtMonday1), "Your hours must be a number")
txtMonday1.Focus()
txtMonday1.SelectAll()
txtMonday1.ForeColor = Color.Red
Exit Sub
End If
This works. Thanks
|
|
|
|
|
hi
I'm trying to write a code that create DB & tables in MS access using VB, when I excute my code the DB is created but I don't see any table in the DB when I open the access file.
Can any one tell me what's the problem?
This is my code:
Public Function CreateAccessDatabase(ByVal DatabaseFullPath As String) As Boolean
Dim bAns As Boolean
Dim cat As New ADOX.Catalog()
Dim table1 As New ADOX.Table()
Dim cn As ADODB.Connection
cn = New ADODB.Connection
Try
Dim sCreateString As String
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DatabaseFullPath
cat.Create(sCreateString)
bAns = True
Catch Excep As System.Runtime.InteropServices.COMException
bAns = False
'Open the connection
cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\testdb.mdb")
'Open the Catalog
cat.ActiveConnection = cn
'Create the table
table1.Name = "Test_Table"
'Create and Append a new field to the "Test_Table"
'Columns Collection
table1.Columns.Append("PrimaryKey_Field", ADOX.DataTypeEnum.adInteger)
'Create and Append a new key. Note that we are merely passing
'the "PimaryKey_Field" column as the source of the primary key.
'Thi snew Key will be Appended to the Keys Collection of
'"Test_Table"
table1.Keys.Append("PrimaryKey", ADOX.KeyTypeEnum.adKeyPrimary, "PrimaryKey_Field")
'Append the newly created table to the Tables Collection
cat.Tables.Append(table1)
' clean up objects
table1 = Nothing
cat = Nothing
cn.Close()
cn = Nothing
Finally
End Try
Return bAns
End Function
|
|
|
|
|
Fromi what I've seen, this should work. The only problem I can see is that you are specifying the connection string twice, built by two seperate methods.
This is one method:
mesho wrote: Dim sCreateString As String
sCreateString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DatabaseFullPath
cat.Create(sCreateString)
which takes a database file path as a parameter.
The other speicifies a very specific filepath, which could be very different from the above path:
mesho wrote: 'Open the connection
cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\testdb.mdb")
'Open the Catalog
cat.ActiveConnection = cn
This is probably where you're probliem lies. You're looking in one file for the table, but the table was created in another file.
|
|
|
|
|