|
Hi Everyone:
Is there a way I can show the records I added and/or modified to a DataSet before I commit them to the database?
I think it is something like MyDataSet.GetChanges.
Cleako - BTW the problem with the dataset primary ID number being off didn't seem to make a difference when I wrote the data out to the SQL Server Database using the SQLDataAdapter.
Thanks,
Quecumber256
|
|
|
|
|
|
Thank you. I going to see if I can adapt it for my use.
Quecumber256
|
|
|
|
|
I need to download from an FTP site. There are an unknown # of files. I have code to download a single file at a time but have problems getting the file names. The error message is invalid username/password when I use Path.GetFiles(strPathName).
|
|
|
|
|
Let's see the code you're using to try and get the files. The Path class doesn't have a GetFiles method. The Path class doesn't work with FTP sites, so I don't know why you're using it.
|
|
|
|
|
As you can see, I tried a couple of different methods. I also tried some of these inside the FTP class after the logon. I also tried to FTP.Logon. The upload works, but I know the filename that I have createed for the upload.
'FTP.DownloadAllFiles(strSource, strDest)
'For Each fname In My.Computer.FileSystem.GetFiles(strSource)
' strDest = strDest & fname
' strSource = strSource & fname
'FTP.DownloadFile(strSource, strDest)
'If FTP.flag_bool Then
' ctr = ctr + 1
'End If
' Next
'Dim f1 As New FileIOPermission(FileIOPermissionAccess.Read, strSource)
'Dim f2 As New FileIOPermission(FileIOPermissionAccess.PathDiscovery, strSource)
'fname = Dir(strSource)
'My.Computer.FileSystem.CopyFile(strSource, strDest)
'Dim filenames() As String = Directory.GetFiles(strSource)
'Do While fname.Trim > " "
'For i = 0 To filenames.Length - 1
' fname = Path.GetFileName(filenames(i))
' strDest = strDest & fname
' strSource = strSource & fname
' FTP.DownloadFile(strSource, strDest)
' If FTP.flag_bool Then
' ctr = ctr + 1
' End If
' 'fname = My.Computer.FileSystem.GetName(strSource)
' 'Loop
'Next
|
|
|
|
|
Are you actually using this code? Because every line is commented out...
This code won't work at all. Your combining filesystem objects and methods with FTP ideas. There two just don't work together at all.
What is "FTP" as defined in your code? There is no definition nor a Dim statement showing what kind of object it is.
You're using .NET Framework 2.0, so there is an FtpClient class built in, which your code isn't using at all as far as I can tell. FtpClient docs[^]
|
|
|
|
|
FTP is the FTP class that I built for .NET 2003 (from an MSDN sample). The upload works. But the download needs a file name. The ftp site is in our network so it can be accessed as an ftp site or as a file (windows explorer or internet explorer). The code is commented out when I copied it because there are about 3 different (though similar) methods that I copied from samples I found in help or on-line.
|
|
|
|
|
I need help with a bug in a program for a PPC device.
The following line of code results in a “FormatExceptionWasUnhandled” error:
If Mid(DecimalPart, 1, 1) <> "1" Then
DecimalPart is a String variable containing the text “.5”.
When I set up a Watch for Mid(DecimalPart, 1, 1) the result is “.” and for Mid(DecimalPart, 1, 1) <> "1" the result is “True”.
I am sure I am missing something incredably simple, I just can not figure out what.
Thanks,
David Wilkes
|
|
|
|
|
The FormatException gets thrown when the formatting for an argument does match the parameter specifications of the method. There's nothing in this code that would throw that exception because the Mid function doesn't expect the string parameter to be in any format.
Besides, why are you using the old VB6 Mid function? You should be using the methods in the String class, like
If DecimalPart.StartsWith("1") Then
|
|
|
|
|
Thanks for the reply!
This is what I get for being lazy. Using MID? I was using a function someone else wrote (no sense reinventing the wheel right?). I figured out last night that it was part of the line just prior to this that was actually throwing the error (not used to this environment yet). When I stripped it down I figured out it was trying to do Val(".")
So I just did what I should have done from the start and write my own function.
David Wilkes
|
|
|
|
|
My co-worked and I have a debate going, he's trying to tell me that you cannot check to see if an event has been raised in VB.Net, is this true? If not does anyone have some examples I can look at?
"Okay, I give up: which is NOT a real programming language????"
Michael Bergman
"Well yes, it is an Integer, but it's a metrosexual Integer. For all we know, under all that hair gel it could be a Boolean."
Tom Welch
"Let's face it, the average computer user has the brain of a Spider Monkey."
Bill Gates
|
|
|
|
|
Unless you put code in your event handler to mark when it has been fired, I'm not aware of a way to tell if it was previously fired.
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
Yes and no, and this is not just a limitation of VB.NET. It's any lanugage that uses Windows Forms and handles events.
There is no log that says which events have fired when. There are only two ways to tell an event fired. The first is in the event handler (obviously!).
The second is to override WndProc and watch for the window message that will cause the event to fire inside your code.
|
|
|
|
|
Hello, I have a tiny tiny problem with this code.
It's a regex that grabs this kinda text
Text: Posted May 17,2005 08:30 AM
Code: ([Pp][Oo][Ss][Tt][Ee][Dd]\s[A-Za-z]*\s\d,\s[0-3000]\s[\d]:[\d]\s[A][M])
I can't see why it's not working, but I'm missing something in the code. Please help.
Thanks a lot!!!
Anthony.
Belief is a beautiful armour.
Knowledge is the sword.
|
|
|
|
|
regexlib.com[^] has a regex tester and cheat sheets, and is where I go with problems like this.
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
You only match one digit for the date, but you need to match one or two.
The set [0-3000] will not be recognised as a range of numbers, it will be a set of the digits 0-3, 0, 0 and 0.
You only match one digit for hours, but you need two.
You only match one digit for minutes, but you need two.
You only match AM times, but PM times will fail.
Sets containing one one character is superflous. [A] is the same as plain A.
---
single minded; short sighted; long gone;
|
|
|
|
|
ya he is correct in addition you r calculating single space onlyso \s* has to be gven
with regards
Balagurunathan.B
|
|
|
|
|
Hello Guffa
Thanks for your help back then.
I am trying to index with his regex but it does not pick text that's stored in a HTML tag.
Example: Johnson <b>Peter</b> Smith for the keywords "John" and "Peter" returns only "John"
\\b("+keyword+"'?s?)\\b|(^"+keyword+"'?s?)\\b|\\b("+keyword+"'?s?$)
So how do I go about making the regex pick-up Peter, which is in a HTML tag. Thanks
Anthony, Canada.
|
|
|
|
|
On the contrary. It finds "Peter", but not "John".
Do you have an example that actually does demonstrate what you are trying to do?
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks!
For example, i want to search for James, but because the James in my text is embedded in a BOLD tag, it does not return a result.
So if I have <b>James</b> is there a way I can "remove" the HTML tag, and have only "James" for my regex to pick-up?
|
|
|
|
|
ant1xxx wrote: For example, i want to search for James, but because the James in my text is embedded in a BOLD tag, it does not return a result.
Yes, it does.
ant1xxx wrote: So if I have James is there a way I can "remove" the HTML tag, and have only "James" for my regex to pick-up?
You don't have to. It's matching only "James", not the html tags.
---
single minded; short sighted; long gone;
|
|
|
|
|
We have a main method which calls a sub method 50 times and in turn the sub method calls one more method 5 times. From the first the datatable is passed by byval and one or two value types are passed by byval. The method doesn't make any changes to the variables
1. Byval or Byref - which will be faster-multiple times and multilevels calling?
2. Will that be a good idea to have multiple levels of methods to be called multiple times. We have lot of local variables. Will the garbage collectors's headache be more in creating and destroying the objects?
Thanks
|
|
|
|
|
ByVal means that the method will create its own copy of the variable, and any changes will not be passed back to the method that called it.
ByRef means the method will use the variable you passed in and update it.
Some objects (I believe DataTables are one example of this) are always passed ByRef even if you specify ByVal because they are so complex.
It sounds like what you want to do is use ByRef. Running a method that updates a couple variables 50 * 5 = 250 times shouldn't be too much for an average computer today. If you were updating several hundreds of thousands than you may worry about it more.
Hope this helps.
|
|
|
|
|
thank you i never fully got that. i even goggled it before and never saw good answer.
|
|
|
|