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 ()