에 매개 변수로 OracleLob 전달 : 이제나는 비슷한 일을 수행하고자하는 기능
try
{
openConnection();
OracleCommand cmd = new OracleCommand("SELECT CUSTOMER_ID, IMAGE_BLOB FROM CUSTOMER_IMAGE WHERE CUSTOMER_ID IN (3026)", conn);
string pubID = "";
OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
//create the report object
MemoryStream memStream;
DataSet ds = new DataSet();
DataTable ImageTable = new DataTable();
BinaryReader binReader;
DataRow dr;
byte[] byteArrName;
OracleLob blob;
while (reader.Read())
{
pubID = reader.GetValue(0).ToString();
// Obtain a LOB
blob = reader.GetOracleLob(1);
// Create a byte array of the size of the Blob obtained
byteArrName = new byte[blob.Length];
// Read blob data into byte array
int i = blob.Read(byteArrName, 0, System.Convert.ToInt32(blob.Length));
//Copied the contents of byte array to stream
memStream = new MemoryStream(byteArrName);
//Create a column of type byte[]
ImageTable.Columns.Add(new DataColumn("id", typeof(string)));
ImageTable.Columns.Add(new DataColumn("image", typeof(System.Byte[])));
//Reading the stream which has the blob data
binReader = new BinaryReader(memStream);
dr = ImageTable.NewRow();
dr["id"] = pubID;
//ReadBytes method to add a byte array of the image stream.
dr["image"] = binReader.ReadBytes((int)binReader.BaseStream.Length);
ImageTable.Rows.Add(dr);
memStream.Close();
binReader.Close();
}
ds.Tables.Add(ImageTable);
//Creating a temporary dataset which hold the image
ds.WriteXmlSchema(@Directory.GetCurrentDirectory() + "\\temp.xsd");
reader.Close();
conn.Close();
}
, 나는 이미지가 동적으로 표시됩니다 있도록 수정 보고서에서 그 temp.xsd를 채울 수 있습니다. 이것은 처음부터 쓴 예제 코드 일 뿐이지 만 시나리오를 적용하기 위해 이미 dtAcctSigner.Rows[0]["IMAGE_BLOB"],
에있는 이미지를 가져와야하므로 위의 코드를
OracleDataReader.GetOracleLob();
는,이 같은 함수에 매개 변수로 데이터 테이블 (유형-OracleLob)의 열을 전달해야
Update(dtAcctSigner.Rows[0]["IMAGE_BLOB"]);
그리고 다음과 같은 기능은 간다 :
public void Update(OracleLob a)
{
// I want to do take the OracleLob and make into a memorystream and put it into temp.xsd here
}
는하지만 오류가 발생합니다 :
cannot convert 'object' to 'OracleLob'
날 내가 잘못 뭘하는지 알려 주시기 바랍니다.
일을 알고이 방법이나 다른 방법을 시도하는 당신에게 달려 것 그럼 .. 또한 비어있는 코드 메소드를 게시하지 마십시오 .. 우리가 당신을 도울 수 있다면, 당신은 당신이 가지고있는 문제에 관해 좀 더 명확하고 구체적이어야합니다. 이것은 약간 혼란 스럽습니다/어렵습니다. 당신이 성취하고자하는 것을 따라하십시오. 전달 방법에 대한 전체 코드를 보여주십시오. 업데이트 (dtAcctSigner.Rows [iCount1] [ "SIGNATURE_BLOB"]); 뿐만 아니라 데이터 테이블을 선언 할 때 – MethodMan
감사합니다. 코드를 편집합니다. 일을 할 때 정말 1. 자연 3의 매우 추상적 인 개별 2로 충분한 연구를 표시하지 않는 question..etc –
대부분의 사람들은 downvote : 나는 PLS, 질문을 편집 그것 좀 봐 – MethodMan