如何通过网络服务访问类. [英] how to acessing a class throuth webservices.
本文介绍了如何通过网络服务访问类.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一门课程
i have a class course
public static class Course
{
static SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
public static bool Updateuserdetails(string Name, string useremail, string usercont)
{
bool Result = false;
try
{
conn.Open();
SqlCommand cmd = new SqlCommand("Select_User_Details", conn);
cmd.CommandType = CommandType.StoredProcedure;
String strResult = String.Empty;
strResult = Convert.ToString(cmd.ExecuteScalar());
conn.Close();
if (strResult.Length == 0)
{
MessageBox.Show("Inserting new user");
Course.Saveuserdetails(Name, useremail, usercont);
}
else
{
MessageBox.Show("user already exist");
SqlCommand cmmd = new SqlCommand("Update_user_details", conn);
cmmd.CommandType = CommandType.StoredProcedure;
cmmd.ExecuteNonQuery();
}
我想输入Web服务..
I WANT TO PUT IN WEBSERVICES..
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class LoginPage : System.Web.Services.WebService
{
[WebMethod]
public bool insert()
{
Db_Helper.Course.Updateuserdetails();
Db_Helper.Course.Saveuserdetails(Name, useremail, usercont);
但是在方法访问中显示错误....请检查它
BUT IT SHOWS AN ERROR IN ACESSING IN METHOD....PLEASE CHECK IT
推荐答案
您确定使用的是正确的方法名称,方法签名不匹配;
在课程中,您拥有;
Are you sure you are using the correct method names, the method signatures do not match;
In Course you have;
public static bool Updateuserdetails(string Name, string useremail, string usercont)
在WebService中,您拥有;
In the WebService you have;
Db_Helper.Course.Updateuserdetails();
和
and
Db_Helper.Course.Saveuserdetails(Name, useremail, usercont);
Web服务中的第二个调用是否不是 Updateuserdetails(blah blah blah)
;并整理第一个.
Should the second call in the webservice not be Updateuserdetails(blah blah blah)
; and bin the first one.
这篇关于如何通过网络服务访问类.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文