我必须使用KSOP网络服务上传图片。 我必须将它上传到服务器数据库。
中的其他数据String strquery = "insert into SNGTADMIN.sprint_mobile_task_dtl(SITE_NBR,SITE_ASSET_NAME,TASK_ID, PHYSICAL_CONDITION,VISIBLE_RUST,BLACK_SMOKE,ENCLOSURE_OIL_LEAK,BATTERY_FLUID_LEAK,AUTO_EXERCISE_STATUS,BATTERY_STATUS,TRANSFER_SWITCH_CONDITION,ALARM_NOT_RECV_BEFORE_REPAIR,ALARM_NOT_RECV_AFTER_REPAIR,ARRIVAL_FUEL_LEVEL,CUM_METER_READING,DESCRETE_ONSITE_WORK,FUTURE_RECOMMENDED_WORK,AFTERVISIT_EVAL_SUMMARY,ACCESS_INSTR_CLAR_NEEDED,MAINT_NOTES,FIELD_PROXIMITY) values('"+ siteId+ "','"+ asset_type+ "','1','" + phyCondion+ "','"+ visbleRust + "','" + heavyBlackSmoke+ "','"+ fuelOrOilLeak + "','" + bateryFluidLeaks+ "','"+ exceriseStatus
+ "','" + batteryStatus + "','" + transferSwitch+ "','" + beforeRepair + "','" + ostRepair
+ "','" + fuelLevelUponArrival + "','" + cumulativeRunHour+ "','"+ discretionaryWork + "','" + additionalWork+ "','"+ evaluationSummaryAfterVisit+ "','"+ accessInstrustions
+ "','" + maintenanceNotes+ "','"+ fieldFarmProximity + "')";
并使用
PropertyInfo pi = new PropertyInfo();
pi.setName("strSQl");
pi.setValue(strquery);
pi.setType(String.class);
request.addProperty(pi);
不知道如何在此查询中添加图片。如果我没有发送图像,它可以正常工作。
帮助我。
答案 0 :(得分:0)
答案 1 :(得分:0)
你可以这样做.. !!我是通过拨打.asmx webservice
Web服务的代码可以编码如下:
public class FileUploader : System.Web.Services.WebService
{
[WebMethod]
public string UploadFile(byte[] f, string fileName)
{
// the byte array argument contains the content of the file
// the string argument contains the name and extension
// of the file passed in the byte array
try
{
// instance a memory stream and pass the
// byte array to its constructor
MemoryStream ms = new MemoryStream(f);
// instance a filestream pointing to the
// storage folder, use the original file name
// to name the resulting file
FileStream fs = new FileStream(System.Web.Hosting.HostingEnvironment.MapPath
("~/TransientStorage/") +fileName, FileMode.Create);
// write the memory stream containing the original
// file as a byte array to the filestream
ms.WriteTo(fs);
// clean up
ms.Close();
fs.Close();
fs.Dispose();
// return OK if we made it this far
return "OK";
}
catch (Exception ex)
{
// return the error message if the operation fails
return ex.Message.ToString();
}
}
希望这对你有用..如果你需要任何其他帮助。然后问问。