|
ok , I see that you want more to speak for other topics than the question topic.
Can you please , show me what is the phrase that I wrote and has attacked someone ?
And , to not repeat the "possible" mistake , do you have any moral code here that I can read and not make an error anymore?
Thank you !
|
|
|
|
|
satc wrote: ok , I see that you want more to speak for other topics than the question topic. Just the post I replied to.
satc wrote: do you have any moral code here that I can read and not make an error anymore? Same as asking for help in the street.
Any street, any part of the world.
satc wrote: Thank you ! You're welcome
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
sorry , really I don't understand what I have done wrong.
|
|
|
|
|
On the suggestion on writing a small application to reproduce the issue, you replied;
satc wrote: Have you tried this before speaking ?
The intention was only to explain the reasoning behind the vote; I see I merely created more bickering
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
If you follow the thread , you will see that the solutions proposed were not working for me.
So I just was asking if someone has tried or just give several suggestion : try this , or try this , or try this....
I think if someone post a solution that is proved to give a correct result is better.
What is wrong to ask if someone has tried something ?
Sorry , but I can't read all the users profile to know that someone is a specialist , or no.
Taking your example for " ...someone asking for help at street ..." I have a similar case :
" A person has break a leg in the street , and someone tell to use a specific mode to bandage. I may ask to this person: Sorry have you tried this before ? "
What is wrong with this question ?
If this "someone" respond : "Yes because I'm a nurse" , I will respond " sorry I didn't know it"
Thank you !
|
|
|
|
|
|
I suspect it may be the RichTextBox and the way it treats it's content. I suggest changing the control to a normal TextBox allow it to accept line feed (Return) and see what the results are.
Caveat, I have not worked with winforms controls for over 5 years so this may be completely wrong.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
My formula or code is terrible for calculating the percentage complete based on 100
There must be a better way to write this.
Just looking for suggestions, in this example, there are 330 records, and the step is .0627
So the first value is -1, and the program bombs. Now my m_progressPos is always 0.
I mostly write web apps, so I don't have much experience with this.
This is what I have.
If (itemIndex.Count > 0) Then
dialogPos = 0.0
dialogStep = 100 / itemIndex.Count - 1
dialogWait.UpdateProgress(1, "Located " & itemIndex.Count & " product items(s)")
End If
rC = 0
For Each i As itemIndex In itemIndex
dialogPos += dialogStep
Dim m_dialogPos As Integer = Convert.ToInt32(Math.Round(dialogPos))
m_dialogPos = If(m_dialogPos > -1, m_dialogPos, 0)
dialogWait.UpdateProgress(m_dialogPos, "Calculating profit for " & i.ItemNumber & " (" & rC & " of " & itemIndex.Count & ") ")
load_SR_Invoice_Profit(connection, i.ItemNumber, profits)
rC += 1
Next
<pre>
|
|
|
|
|
(100 / max number of items) * current position.
I would also recommend on updating on a specified interval, not each item. Something like below;
int startTick = Environment.TickCount;
if (Environment.TickCount - startTick > 250)
{
UpdateStatus();
startTick = Environment.TickCount;
} That way you get the optimal througput without having to synchronize to the mainthread for each item.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Possibly an easier way for you to achieve your result would be to set the Progressbar maximum property in your dialog to the itemIndex.Count value, that way you won't have to worry about the calculating your percentage - just set the progress bar value from i to itemCount
To do this you would need to create a new property for your dialogWait class to hold the progress bar maximum e.g.
Class dialogWait
Public WriteOnly Property progressmax() As Integer
Set(value As Integer)
myprogress.Maximum = value
End Set
End Property
(this is assuming you have a progress bar control called myprogress of course). Then you could change your main code section to this
If (itemIndex.Count > 0) Then
dialogWait.progressmax = itemIndex.Count
End If
rC = 0
For Each i As item In itemIndexes
rC += 1
dialogWait.UpdateProgress(rC, "Calculating profit for " & i.ItemNumber & " (" & rC & " of " & itemIndex.Count & ") ")
load_SR_Invoice_Profit(connection, i.ItemNumber, profits)
Next
|
|
|
|
|
I was pretty brain dead this day, I should of said that I wanted to keep the max value at 100%, and constantly calculate for any number of records at 100%.
So today with the progress bar breaking, I took the time to fix it, and went to a basic calculator website to figure out the formula, in which there really was no formula, just basic math that was so simple.
And yes this is the loop function that I wrote about in my post in the database form about merging SQL for FoxPro statements that I posted 5 mins ago.
In the end, I need to dump this code for something faster, but it works for now until I can figure out something better.
So thanks Eddy for the suggestion, and the other op as well.
If (invIndex.Count > 0) Then
dialogPos = 0.0
dialogWait.pb_progress.Maximum = 100
dialogWait.UpdateProgress(0, "Located " & invIndex.Count & " invoices(s)")
Dim rC As Integer = 0
For Each i As invoiceIndex In invIndex
Dim m_percentage As Decimal = ((rC / invIndex.Count()) * 100)
Dim m_dialogPos As Integer = Math.Round(m_percentage)
dialogWait.UpdateProgress(m_dialogPos, "Calculating profit for Invoice " & i.InvoiceNumber & " (" & rC & " of " & invIndex.Count & ") ")
load_SR_Invoice_Profit(connection, i.InvoiceNumber, profits)
rC += 1
Next
|
|
|
|
|
I create a class to use in List(of class)
Then I'm populating the class with item names.
I wrote this, but I'm still getting duplicate value, so I got it wrong somewhere.
Dim reader As System.Data.OleDb.OleDbDataReader = command.ExecuteReader()
While reader.Read()
Dim m_itemNumber As String = reader.GetValue(0)
If Not p.Contains(New itemIndex() With {.ItemNumber = m_itemNumber}) Then
p.Add(New itemIndex() With
{
.ItemNumber = reader.GetValue(0)
})
End If
End While
Maybe I got it wrong in the SQL
" SELECT " & _
" DISTINCT FITEMNO " & _
" FROM " & _
"( " & _
" SELECT " & _
" h.FITEMNO " & _
" FROM ARTRS01H.dbf h " & _
" WHERE h.FINVNO = @FINVNO " & _
" UNION ALL " & _
" SELECT " & _
" v.FITEMNO " & _
" FROM ARTRS01.dbf v " & _
" WHERE v.FINVNO = @FINVNO " & _
") " & _
" GROUP BY FITEMNO "
|
|
|
|
|
Sort of like SQL Linq.
Dim reader As System.Data.OleDb.OleDbDataReader = command.ExecuteReader()
While reader.Read()
Dim m_itemNumber As String = reader.GetValue(0)
Dim aFlag As Boolean = p.Exists(Function(m) m.ItemNumber = m_itemNumber)
If (False = aFlag) Then
p.Add(New itemIndex() With {
.ItemNumber = m_itemNumber
})
End If
End While
|
|
|
|
|
Hello !
Is there any library to compare 2 SQL server databases inside a vb.net program ? ( I mean to compare the structure and relationships, no data)
Thank you !
|
|
|
|
|
|
About the SMO , can you specify some more information , because on that link I can't find any way to do this.
|
|
|
|
|
It's a big library so you need to navigate through the documentation. To have something to start from , have a look at:
|
|
|
|
|
Have a look at OpenDBDiff[^]
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
This doesn't seems to be used from inside a vb.net application , but as a external tool.
|
|
|
|
|
You may or may not be able to integrate the supplied source code
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
For this I need some help
|
|
|
|
|
You know how this site works, right? You start yourself and if you run into a specific problem you can ask
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
No , I don't know. Thank you for telling me.
But what if I don't know how to start ?
Can't this forum help someone how to start ?
|
|
|
|
|
I wrote this piece of code in the event of a textbox LEAVE where I enter the city automatically brought in CAP PR and the results of a query ....
Making debugging line by line VS 2010 jumps the line Dim laws as OdbcDataReader and therefore it does not perform the query and gives me error as if there were no data.
I made a few mistakes in the code?
Private Sub txtPaese_Leave_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPaese.Leave
Try
Dim cn As New OdbcConnection("dsn=PHOENIXDB;uid=SYSDBA;pwd=masterkey;")
Dim com As String = txtPaese.Text
Dim strCn As String = "Select distinct * from TBL_COMUNI where COMUNE='" & com & "'"
Dim cmd As OdbcCommand = New OdbcCommand(strCn)
Dim leggi As OdbcDataReader
Dim daSelPaese As New OdbcDataAdapter
Dim dsSelPaese As New DataSet
cn.Open()
daSelPaese.SelectCommand = cmd
daSelPaese.SelectCommand.Connection = cn
daSelPaese.Fill(dsSelPaese, "TBL_COMUNI")
leggi = cmd.ExecuteReader
Me.txtCAP.Text = leggi.Item(11)
Me.txtPR.Text = leggi.Item(4)
leggi.Close()
cn.Close()
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
End Try
End Sub
|
|
|
|
|
Your code is vulnerable to SQL Injection[^].
NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.
You're executing your command twice - once to fill a DataTable , which you then throw away, and once with the ExecuteReader method.
You've then tried to access columns from the returned OdbcDataReader object without first calling its Read method. This will throw an exception.
Your query is selecting multiple rows from the table, but you're only using the first row. You should change it to only select a single row instead.
You're using SELECT * FROM ... , which returns every column in the table. You're then only using two columns. Change your query to return only the columns you need.
You should also wrap any objects that implement IDisposable in a Using block.
Private Sub txtPaese_Leave_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPaese.Leave
Try
Using cn As New OdbcConnection("dsn=PHOENIXDB;uid=SYSDBA;pwd=masterkey;")
Dim query As String = "SELECT TOP 1 * FROM TBL_COMUNI WHERE COMUNE = ?"
Using cmd As New OdbcCommand(query, cn)
cmd.Parameters.AddWithValue("p0", txtPaese.Text)
cn.Open()
Using reader As OdbcDataReader = cmd.ExecuteReader(CommandBehiavor.CloseConnection)
If reader.Read() Then
Me.txtCAP.Text = reader.Item(11)
Me.txtPR.Text = reader.Item(4)
Else
End If
End Using
End Using
End Using
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
End Try
End Sub
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|