 |
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

December 2nd, 2003, 07:38 AM
|
Authorized User
|
|
Join Date: Jul 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
NEED HELP! retrieving from database
am working on a project on vb.net, a windows service. I am trying to compare two fields in a database, and increment a counter and place its value in another field of the database. I conceptually understand how to do it, but am unable to code it. I then want to create a code that will get the field with the highest increments and display it on the interface. Does anyone have any ideas? I NEED SOME HELP!!!
Thanks!
nvillare
__________________
Thanks!
N
|

December 2nd, 2003, 07:39 AM
|
Authorized User
|
|
Join Date: Jul 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I guess another thing I would need is looping thru a dataset.
Thanks!
nvillare
|

December 2nd, 2003, 10:22 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Are the fields you are comparing getting changed externally and your service is watching to see that they changed?
Peter
------------------------------------------------------
Work smarter, not harder.
|

December 2nd, 2003, 01:26 PM
|
Authorized User
|
|
Join Date: Jul 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It is supposed to be a sniffer windows service. THe service picks up the packets and send them to a database. I am also having trouble with that. The interface gets the information from the database and displays it to the user. What I am having trouble on this part, is getting the interface to perform a SQL that states, look at each field for the highest occurence IP address, display that IP address along with its information, source, destination, time and date. What the service does is get the IP packets from the network insert them into the database. It first checks to see if it is already on the database, if it is, it increments the "reoccurence" field by one, if it's not, it makes a new entry into the database. This is where the interface loops through each row in the "reoccurence" field and checks which one has the highest number to display as previously mentioned.
Any help is greatly needed! I am completely lost!
Thanks!
nvillare
|

December 2nd, 2003, 01:41 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Well... you don't need to loop thru anything to get the highest recurring value. You can use a simple select query that sorts based on that value.
For the updating/inserting part I'd recommend creating a stored procedure that handles the checking of an existing row, and does either an insert or an update accordingly. Put this in your stored procedure:
UPDATE myTable SET reoccurence=reoccurence+1
FROM myTable
WHERE ipAddress=@ipAddress
IF @@ROWCOUNT=0
INSERT INTO myTable VALUES(@ipAddress, 0)
This will attempt to update an existing record, if no rows are affected, the row doesn't exist, so insert it.
Peter
------------------------------------------------------
Work smarter, not harder.
|

October 22nd, 2004, 12:37 AM
|
Registered User
|
|
Join Date: Oct 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i have this problem!
|
|
 |