|
You said in your description you have two tables. But, this operation you're describing is only working on one table. Which is it? Shouldn't the WHERE clause lok like this:
SELECT COUNT(OrderName) As ExistingRecords FROM OrdersListBoxInfo WHERE OrderName=?
I also don't like using AddWithValue . It leaves too much up to interpretation by the OleDbParameter class. I'd do it like this instead:
cmd.Parameters.Add("@OrderName", OleDbType.VarChar, 50).Value = OrderName
You might also want to validate what's in OrderName before you assign the value to the parameter.
|
|
|
|
|
I’ve got a function for sending a file to a remote host wich Is as follows
Public Sub SendFiles(strTemp As String)
Dim lngWnd As Long
Dim strTxtFile As String, strBchFile As String
strBchFile = "c:\trace.bat"
strTxtFile = "c:\trace.txt"
Open strTxtFile For Output As #1
'cchs
Print #1, "open myhostname"
Print #1, "MYUSERNAME"
Print #1, " mypassword "
Print #1, "lcd c:\"
Print #1, "cd /disk1/"
Print #1, "bin"
Print #1, "get " & strTemp
Print #1, "disconnect"
'JDP1p000.001
'tnt ftp site
Print #1, "open remotehost "
Print #1, "romote host name"
Print #1, "remote host password"
Print #1, "bin"
Print #1, "put " & strTemp
Print #1, "bye"
Close #1
lngWnd = Shell("ftp -s:" & strTxtFile, vbMinimizedFocus)
Kill "c:\" & strTemp
The problem is that I don’t have a way of knowing whether a file has been transferred successfully or not
Pls help
im a junior developer at a company called securemail in south africa
|
|
|
|
|
This has the makings of a nightmare...
First, you're app is writing a script file, then launching an external application which executes the script. Is this FTP a DOS app or a Windows app?? If DOS, then you need to pipe the FTP app's output to another file using a command line similar to:
ftp -s:scriptname > C:\ftpOutput.txt
When the Shell statement returns, you have to open the ftpOutput.txt file and read its contents and parse it up, looking for keywords that should tell you if the transfer was successful or not.
This WILL NOT WORK if FTP is a Windows app!
The best solution is to scrap all this and rewrite a new app using an actual FTP component in your app where you'll have FAR more control over the transfer process and the results of it.
|
|
|
|
|
Hi
Thank u very much for the quick response .i think i "scrap my function out"
Can u pls give me a link to a sample that i could use for my new function using an ftp component
im a junior developer at a company called securemail in south africa
|
|
|
|
|
tj28 wrote: Can u pls give me a link to a sample that i could use for my new function using an ftp component
I don't have any VB6 examples. I haven't used it in about 6 or 7 years now...
Googling for "VB6 ftp example" reveals a bunch[^] though.
|
|
|
|
|
Does anyone understand why when i put an image in the background of a form that it displays correctly for approximately 5 seconds but then the same image is applied within the window overlapping the first image but offset. The only way i've found to get around this is to set the 'Show in taskbar' to false.
I've also found that if i minimise the form and then restore it, it does exactly the same thing, the image in the form appears okay for 5 seconds and then does this overlap thing.
The form is approximately 800x600 pixels and set to appear in the centre of the desktop. If i set the form to 'manual' and have it start at position 0,0 then the overlap thing doesn't occur, or if it does, then it's not obvious as it must be overlapping in exactly the same position.
Any ideas other than putting it into a picture box, which isn't an option as i have text with it's back colour set to transparent, and the transparency is obviously lost if i put text over a picture box.
Brian Hull
|
|
|
|
|
What happens if you create a new project and set the default form's background image to this image and run it?
|
|
|
|
|
I have tried making a new project, and it does exactly the same thing.
I'm beginning to think that it's a bug in the software.
Brian Hull
|
|
|
|
|
Not one I can replicate.
How about with a different image of the exact same size and color depth? What are those numbers anyway?
Is this a multi-frame image?
|
|
|
|
|
I have tried this with different images of the same size and different size, but it always does it.
Sorry but i don't know what a multi frame image is.
I could always email you the screen grab and the original file for you to take a look at?
Brian Hull
|
|
|
|
|
Brizee wrote: Sorry but i don't know what a multi frame image is.
You've seen animaed GIFs, right? That's a multiple frame image. Each step in the animation is a seperate frame. Multiple full-frame images in the same file.
Hmmm... I can't seem to duplicate the problem. BackgroundImage of the Form, right?
|
|
|
|
|
Sorry for being so dense.
It's not a multiple frame image no, just a BackgroundImage on the form, an index coloured png file at that, just to try and keep the file size down.
Basically i have made a card game and in the game you choose one of 5 options and depending on the option chosen dictates which backgroundimage is visible. It's basically to give it a nice GUI, instead of a plain colour.
I am starting to think that maybe the issue lies simple with my version of VB.Net.
Brian Hull
|
|
|
|
|
Brizee wrote: I am starting to think that maybe the issue lies simple with my version of VB.Net.
Don't count it. I can't duplicate the problem no matter what I do.
Are you doing any painting of the form or any controls yourself?
|
|
|
|
|
When i call it like this:
<br />
Public Delegate Function EnumFuncDeleg(ByVal hwnd As Long, ByVal lParam As System.Text.StringBuilder) As Long<br />
<br />
Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As EnumFuncDeleg, ByVal lParam As Long) As Long<br />
<br />
'<br />
'<br />
' Inside function<br />
EnumChildWindows(ProcessInfo.Handle, AddressOf EnumChildWindow, Nothing)<br />
I get an error saying that: System.AccessViolationException was unhandled
Message="An atempt was made to read protected memory, this often inditaces that memory is corrupt."
What could be wrong? It dosent mater what window i try to enum, i allways get the same results
All feedback is welcome
Thanks
|
|
|
|
|
Your delegate declaration is awry - the lParam parameter should be an Int32
Also - in VB.net a 32 bit number is not a Long - replace all instances of Long with Int32.
<br />
Public Delegate Function EnumFuncDeleg(ByVal hwnd As Int32, ByVal lParam As Int32) As int32<br />
<br />
Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Int32, ByVal lpEnumFunc As EnumFuncDeleg, ByVal lParam As int32) As int32<br />
<br />
'<br />
'<br />
' Inside function<br />
EnumChildWindows(ProcessInfo.Handle, AddressOf EnumChildWindow, Nothing)
|
|
|
|
|
Thank you for that! It works lika clockwork now
|
|
|
|
|
Can anybody help me with a little nightmare that i'm having?
I am trying to make a countdown timer in VB.net showing years, months, hours, minutes and seconds, and i want it to tell me the time between two dates and then count down to that appointment.
I've tried playing with the date.interval class and have got myself in a mess.
Please help me.
Brizee
|
|
|
|
|
It would be easier to help, if you specify what kind of problem you are facing. Tell us what your doing with the code and what is the error or problem you are facing with the data.
You can use the Date.Timespan class to get the difference between two dates and use a timer control to do what you want.
|
|
|
|
|
Thanks for the information. I will try and utilise the Date.Timespan class instead of the Date.Interval class, and hopefully i will make some headway.
Many Thanks.
Brian Hull
|
|
|
|
|
You could display "Now" and then set the timer event to update the textbox/label and set the timer interval to 1000 milliseconds (1 second).
Here is a sample
Dim d As Date
Dim ts As TimeSpan
Private Sub TimerTick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
d = #12/25/2007#
ts = d.Subtract(Now)
Label1.Text = ts.ToString
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
|
|
|
|
|
Hey thanks for your help, you've got me sorted and it works a treat. I can now start getting this implemented into my application.
Brian Hull
|
|
|
|
|
Could i ask another question which really is about syntax. What if i want to put a date and time into d, would that then be #12/25/2000/12.45#.
I'm presuming this isn't correct?
Brizee
|
|
|
|
|
Hi
I used CoCreateGuid window API in vb 6.0 application it works fine.
But for vb.net it makes problem, if anybody know please tell me how i used it in my vb.net code.
Thanks
Thanks
|
|
|
|
|
bony_baba wrote: But for vb.net it makes problem
Care to explain the problem or error you're getting?
bony_baba wrote: if anybody know please tell me how i used it in my vb.net code.
Show us your VB.NET code and we'll see what we can do to help you. We won't write it for you.
|
|
|
|
|
i Upgrade my vb 6.0 application to Vb 2005 it works fine in vb 6.0 but not in vb.nET.
Now the problem is solved actually it makes problem in passing structure without marshalling.
Thanks
Thanks
|
|
|
|