이 질문은 완전히 중복 될 수 있으며 사과드립니다. 하지만 난 웹 서비스플래시 빌더의 HTTP 서비스를 사용하여 C# webservice에 데이터를 보내십시오.
var ResponseValue:int = 1;
var QuestionID:int = data.QuestionID;
ResultsQuestion = new ArrayCollection();
ResultsQuestion.addItem({"ResultSEQ":10000});
ResultsQuestion.addItem({"QuestionID":QuestionID});
ResultsQuestion.addItem({"ResponsePromptID":chk1.name});
ResultsQuestion.addItem({"ResponseValue":ResponseValue});
var service:HTTPService = new HTTPService();
service.url = "http://IPaddress:443/InsertData/Service1.asmx/HelloWorld";
//service.url = "http://localhost/InsertData/InsertData/Service1.asmx/HelloWorld";
service.method="POST";
var parameters:Object = new Object();
parameters["ResponsePromptID"]= ResultsQuestion.getItemAt(2).ResponsePromptID;
parameters["QuestionID"]= ResultsQuestion.getItemAt(1).QuestionID;
parameters["ResponseValue"]= ResultsQuestion.getItemAt(3).ResponseValue;
service.send(parameters);
에 데이터를 전송하는 플래시 빌더를 사용하여 내 안드로이드 응용 프로그램에서이 코드를 가지고 있고이 데이터는 SQLServer에로 반환 삽입 할. 그리고 저것을 위해 나는이 webservice를 썼다.
[WebMethod]
public string HelloWorld()
{
string Message;
string MyConString = "Data Source=.\\SQLEXPRESS;Server=nameof server;Database=dbname;User ID=id;Password=password;Trusted_Connection=False; ";
System.Data.SqlClient.SqlConnection DbConnection = new System.Data.SqlClient.SqlConnection(MyConString);
DbConnection.Open();
SqlCommand DbCommand = DbConnection.CreateCommand();
string QuestionID= System.Web.HttpContext.Current.Request.Params["QuestionID"];
// string QuestionID = "89";
string ResultSEQ = "1999";
string ResponsePromptID =System.Web.HttpContext.Current.Request.Params["ResponsePromptID"];
// string ResponsePromptID ="343";
string ResponseValue = "12";
DbCommand.CommandText = "Insert into [dbo].[tablename] (ResultSEQ,QuestionID,ResponsePromptID,ResponseValue) Values(@ResultSEQ,@QuestionID,@ResponsePromptID,@ResponseValue)";
DbCommand.Parameters.AddWithValue("@ResultSEQ", ResultSEQ);
DbCommand.Parameters.AddWithValue("@QuestionID", QuestionID);
DbCommand.Parameters.AddWithValue("@ResponsePromptID", ResponsePromptID);
DbCommand.Parameters.AddWithValue("@ResponseValue", ResponseValue);
int result = DbCommand.ExecuteNonQuery();
if (result == 1)
{
Message = "1";
}
else
{
Message = "2"; ;
}
DbConnection.Close();
return Message;
}
}
그러나 삽입 된 데이터가 보이지 않으며 오류가 표시되지 않습니다. 그래서 나는 무엇이 잘못되었는지 확신하지 못한다. 아마도이 모든 것이 잘못된 것입니다. 그러나이 코드의 문제점은 무엇입니까? 그리고 내 flex HTTPService가 보낸 데이터를 볼 수있는 방법이 있습니까? 정말 고마워요!
마침내 로컬 호스트에서 작업하고 위 코드를 변경했습니다. – satish
하지만 서버에서 어떤 아이디어도 동일하게 적용되지 않습니까 ?? – satish
오류 이벤트를 넣었고 # 2032 오류가 발생했습니다. HTTP 요청 오류가 발생했습니다. 그러나 데이터 검색에 동일한 서버를 사용하고 있습니다. 내가 바라 봐야 할 서버 설정들이다. 도와주세요. – satish