i have created web service using asmx page in which has a method
[WebMethod]
public string InsertStudent(string Name, string Gender, string City)
{
operation oper = new operation();
string query = string.Empty;
try
{
oper.Trans_Begin();
query = @"SELECT MAX(ID)+1 AS ID FROM TBLSTUDENTS";
int id = Convert.ToInt32(oper.DTSET(query).Tables[0].Rows[0]["ID"].ToString());
query = string.Empty;
query = @"INSERT INTO TBLSTUDENTS VALUES('" + id + "','" + Name + "','" + Gender + "','" + City + "')";
oper.sqinsert(query);
oper.Trans_Commit();
return query;
}
catch(Exception ex)
{
oper.Trans_Rollback();
return "error";
}
}
my angular code is
$scope.Save = function () {
let name=$scope.studentname,gender=$scope.studentgender,city=$scope.studentcity;
let datalist=JSON.stringify({Name:name,Gender:gender,City:city});
$http({
url: "Student.asmx/InsertStudent",
method: "post",
headers: {
"Content-Type": "application/json; charset=utf-8",
"dataType": "json"
},
data: datalist
}).then(function (response) {
$scope.message = "Saved Sucessfully";
}), function (reason) {
$scope.message = reason.data;
}
i am getting internal server error please help here is the example
https://groups.google.com/forum/#!topic/firebase-angular/6wLh5oAnpak
for my problem
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bikesh SrivastavaPosted Aug 24, 2016, 7:29 AM