0
[WebMethod]
[ScriptMethod(UseHttpGet = true)]
public void insertarea(string comname, string brandname, string zone, string location, string area)
{
string id = "";
var json = "";
SqlCommand cmdcom = new SqlCommand("select id from companydetails where comname='" + comname + "'", con);
con.Open();
SqlDataReader drcom = cmdcom.ExecuteReader();
while (drcom.Read())
{
id = drcom["id"].ToString();
}
con.Close();
List<object> addarea = new List<object>();
if (brandname != "select")
{
cmd = new SqlCommand("Insert into companyallot values('" + id + "','" + location + "','" + area + "','" + zone + "','" + brandname + "',NULL,NULL,NULL,NULL,NULL)", con);
con.Open();
cmd.ExecuteNonQuery();
json = js.Serialize("Area Added with brandname");
con.Close();
}
else
{
cmd = new SqlCommand("Insert into companyallot values('" + id + "','" + location + "','" + area + "','" + zone + "',Null,Null,Null,Null,Null,Null)", con);
con.Open();
cmd.ExecuteNonQuery();
json = js.Serialize("Area Added For All Brands");
con.Close();
}
Context.Response.Write("{" + '"' + "info" + '"' + ":" + json + "}");
}
次のWebサービスを使用しています。しかし、私は継続的にエラー
でSystem.Web.Services.Protocols.HttpServerProtocol.Initialize() でSystem.InvalidOperationExceptionが取得していているWebアプリ作成しています:insertarea Webサービスをメソッド名が無効です。 System.Web.Services.Protocols.ServerProtocolFactory.Create(タイプタイプ、のHttpContextコンテキスト、HttpRequestの要求、のHttpResponse応答、ブール& abortProcessing)
メソッド名を数回試してみましたが、同じエラーに直面しています。 誰が何が間違っているか分かっていますか?
そして、これは私があなたのAngularjsコードを見たとき、私はあなたが「areaintable」メソッド名$http.get('/allotcompany.asmx/areaintable'
呼び出すことがわかり、私angularjs
機能
$scope.updatefunction = function (param) {
$scope.updateparam = param;
console.log($scope.updateparam.comarea);
$http.get('/allotcompany.asmx/areaintable', {
params: {
comname: $scope.mdcomname,
brandname: $scope.mdbrandname,
zone: $scope.mdzone,
location: $scope.location,
area: $scope.updateparam.comarea
}
}).then(function (response) {
alert(response.data.info);
$scope.gettableinfo();
});
}