C# 如何使用IF-Else插入图像和文本
我有一个基于网络的编程,需要创建一个测验和调查。作为管理员,我需要创建一个测验,我可以插入问题和图像。它与Web服务集成 问题是,当只插入文本时,它会自动将图像插入数据库,而无需选择任何图像,而且我不知道图像来自何处 你们能检查一下有什么问题吗C# 如何使用IF-Else插入图像和文本,c#,asp.net,web-services,C#,Asp.net,Web Services,我有一个基于网络的编程,需要创建一个测验和调查。作为管理员,我需要创建一个测验,我可以插入问题和图像。它与Web服务集成 问题是,当只插入文本时,它会自动将图像插入数据库,而无需选择任何图像,而且我不知道图像来自何处 你们能检查一下有什么问题吗 byte[] answerImage = new byte[0]; String answer = TextBox1.Text; Boolean correctAnswer = Convert.ToBoolean(DropDown
byte[] answerImage = new byte[0];
String answer = TextBox1.Text;
Boolean correctAnswer = Convert.ToBoolean(DropDownList1.Text);
int questionId = Convert.ToInt32(Session["questionID"]);
try
{
if (AsyncFileUpload1.FileBytes != null)
{
answerImage = new byte[AsyncFileUpload1.PostedFile.ContentLength];
answerImage = AsyncFileUpload1.FileBytes;
this.ws.createAnswerForAnswer(answer, answerImage, correctAnswer, questionId);
}
else
{
this.ws.createAnswerForAnswer(answer, answerImage, correctAnswer, questionId);
}
{
Label5.Text = "Succesfully Inserted";
TextBox1.Text = "";
Response.Redirect("CreateAnswer.aspx");
}
}
catch (Exception ex)
{
}
}
你提供的信息不足。通过ws发送的图像字节是正确的还是垃圾?两种情况下
FileBytes
都包含哪些内容?正如Sarrus所说,我们需要更多;这个方法签名在哪里?