Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
|
.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
 
Old December 2nd, 2003, 07:38 AM
Authorized User
 
Join Date: Jul 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nvillare
Default 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
 
Old December 2nd, 2003, 07:39 AM
Authorized User
 
Join Date: Jul 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nvillare
Default

I guess another thing I would need is looping thru a dataset.


Thanks!

nvillare
 
Old December 2nd, 2003, 10:22 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Are the fields you are comparing getting changed externally and your service is watching to see that they changed?

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old December 2nd, 2003, 01:26 PM
Authorized User
 
Join Date: Jul 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nvillare
Default

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
 
Old December 2nd, 2003, 01:41 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.
 
Old October 22nd, 2004, 12:37 AM
Registered User
 
Join Date: Oct 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i have this problem!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieving and Uplaoding Images in Database vijay_83 ASP.NET 1.0 and 1.1 Professional 1 October 5th, 2006 02:07 AM
retrieving single value from database Moharo PHP How-To 2 July 5th, 2005 03:29 AM
retrieving from database... URGENT!!! roryosullivan JSP Basics 1 March 9th, 2005 03:11 PM
problem retrieving from database rajuru Beginning PHP 2 October 8th, 2004 12:34 PM
NEED HELP! retrieving from database nvillare ADO.NET 1 December 2nd, 2003 10:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.