Use Microsoft WebService technology to achieve remote database access. Use web services to share the same database among different sites-. NE

Source: Internet
Author: User

With Microsoft Visual Studo. net Beta release, due to Visual Studio. net supports XML and Web services, and uses Visual Studio.. Net Web service applications will become more and more convenient. This document uses a B2B e-commerce website as an example to describe how to use web services to share the same database among different sites. In this article, the client is the party that uses the web Service, and the server is the other party that provides the web service.

Question proposal

This website is an e-commerce website (referred to as A) engaged in online sales of mobile phone SIM cards. Not long ago, the website cooperated with another website (B) to jointly sell Unicom mobile phone SIM cards online. Because the number resources of website A are all used and the database of website A is accessed, I developed an online card sales system for another website using webservice technology.

Modules and key code of Main Functions

1. The database uses SQL SERVER2000 and stored procedures to display the number browsing page. The Code is as follows:
Create procedure fenye
(
@ Pagenow int,
@ Pagesize int,
@ Cityid int,
@ Code char (3 ),
@ Recordcount int output
)
As
Set nocount on

Declare @ allid int, @ beginid int, @ endid int, @ pagebegin char (11), @ pageend char (11)

Select @ allid = count (*) from jinan where cityid = @ cityid and (code like @ code + '% ')
Select @ recordcount = @ allid

Declare cur_fastread cursor scroll
SELECT code FROM jinan where cityid = @ cityid and (code like @ code + '%') order by code

Open cur_fastread
Select @ beginid = (@ pagenow-1) * @ pagesize + 1
Select @ endid = @ beginid + @ pagesize-1

Fetch absolute @ beginid from cur_fastread into @ pagebegin

If @ endid> @ allid
Fetch last from cur_fastread into @ pageend
Else
Fetch absolute @ endid from cur_fastread into @ pageend

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.