[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