紧急!!如何通过网络服务登录 [英] Urgent!! How to login via web serivices
问题描述
我希望使用Web服务登录系统.
我可以知道怎么做吗?
请提供示例Web服务源代码以及如何在asp.net中调用它.
谢谢!!!!!
代表OP从非应答方式移到此处
我试过了但是有问题.我不知道发生了什么错误.希望有人愿意帮助我解决这个问题.
这是我在Web服务中的Web方法.当我调用此Web方法时,尽管我输入了正确的用户名和密码,但我返回的值为0并显示错误消息.
I wish to do my system login by using web services.
May i know how to do it?
Please provide example source code for web services and how to call it in asp.net.
Thanks!!!!!
Moved here on OP''s behalf from non-answer
I have tried it but have problem. i dun know what is the error occur. Hope have some one willing help me solve this problem.
This is my web method in web services.when i invoke this web method, i return the value 0 and show me the error message although i key in the correct username and password.
Public Function Login(ByVal username As String, ByVal password As String) As String()
Dim data(3) As String
' success = New String() {"3"}
Dim validID As Integer
Dim cmd As New SqlCommand
DBStudent.Open()
cmd.CommandText = "SELECT username,studentPass,studentEmel FROM student"
cmd.Connection = DBStudent
Dim myDataReader As SqlDataReader
myDataReader = cmd.ExecuteReader
While myDataReader.Read
If username = myDataReader("username".ToString) And password = myDataReader("studentPass".ToString) Then
data(0) = 1
data(1) = myDataReader("username".ToString)
data(2) = myDataReader("studentPass".ToString)
data(3) = myDataReader("studentEmel".ToString)
validID = 1
Exit While
Else
data(0) = 0
End If
End While
myDataReader.Close()
cmd.Dispose()
If validID <> 1 Then
MsgBox(vbTab + vbTab + "Login fail." + vbCrLf + vbCrLf + "Invalid User", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Status Login")
End If
DBSpin.Close()
Return data
End Function
[/Edit]
[/Edit]
推荐答案
对于初学者,我们都自愿提供时间在这里为您提供帮助.
无论您的请求有多紧急,我们都不在乎.
同样,仅要求提供源代码也不是这里的工作原理.您需要向我们展示您尝试过的内容,遇到问题时,请就这些问题提出具体的编程问题.对于您要的东西,有一个很棒的工具叫做Google,您可能听说过...
For starters, we all volunteer our time to help you here.
We don''t really care either way how urgent your request is.
As well, just asking for source code is not how it works here. You need to show us what you have tried and when you have a problem ask a specific programming question regarding those issues. For what you are asking for, there is a wonderful tool called Google, you may have heard of it...
asp.net login using web service query returned about 30.5 million results. How about starting there.
这篇关于紧急!!如何通过网络服务登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!