Access SQL Server database through FLEX

Source: Internet
Author: User
Tags custom name connectionstrings

A "User Login" interface naturally uses database operations, while flex cannot access the database by itself. Therefore, it uses Web service to access the database. The specific process is as follows:

1. Use Asp.net in vs2008 to publish a WebService

2. Add a SQL-linked string to Web. config.

<Connectionstrings>
<! -- Integrated Identity Authentication (090828) -->
<! -- <Add name = "connusrinf" connectionstring = "Data Source = localhost; initial catalog = qlnormal; Integrated Security = sspi"/> -->
<! -- SQL Server Authentication with username and password (090828) -->
<Add name = "connusrinf" connectionstring = "Data Source = localhost; initial catalog = qlnormal; uid = sa; Pwd = 123456"/>
</Connectionstrings>

3. Compile the corresponding method.

4. Publish the WebService.

1> Open C # first, create a website, select (select) Asp.net web service, and click OK. Now, a new WebService is created.CodeIt's just "Hello World", just a simple test.

2> In the F5 test, a webpage is opened and displayed as OK. Click Generate-> Publish website-> set the path-> OK, OK. Now there is an asmx and DLL file under the path you set.

3> open IIS (My Computer Management> Internet Information Service> website> default website> New> virtual website> wservice, and set the path of your website to be published... next, click "OK" for the website. Then, browse the WebService and service of the website you just created. asmx. it will be opened on the webpage.

5. The format in which flex calls WebService.

<Mx: WebService id = "wbsrv"
WSDL = "http: // localhost/dbserv/service. asmx? WSDL "useproxy =" false "fault =" onfaulthandler (event) ">
<Mx: Operation name = "conn" result = "onresulthandler (event)">
<Mx: Request>
<_ USR> {username. Text} </_ USR>
<_ PW> {password. Text} </_ PW>
</MX: Request>
</MX: WebService>

Id -- custom name. WSDL -- add "? WSDL ".

Operation-Name: The method name defined in Asp.net has the same name.

Request-parameter: The name is the same as that in Asp.net.

6. Call 5 in the flex script.

<WebService Name>. <operation Name>. Send ()

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.