1个回答
展开全部
OracleConnection objOcon=new OracleConnection("user id=system;data source=user;password=pass");
OracleCommand objOcmd = new OracleCommand("select sopinstanceuid,dicomimage from images where
getdate is not null", objOcon);
FileStream fs;
BinaryWriter bw;
int bufferSize = 30; //方
byte[] outbyte = new byte[bufferSize];
long retval;
long startIndex = 0;
string pub_id = "";
pubsConn.Open();
OracleDataReader myReader = logoCMD.ExecuteReader(CommandBehavior.SequentialAccess);
while (myReader.Read())
{
pub_id = myReader.GetString(0);
fs = new FileStream("c:\\dicomimage\\" +pub_id + ".dcm", FileMode.OpenOrCreate,
FileAccess.Write);
bw = new BinaryWriter(fs);
startIndex = 0;
retval = myReader.GetBytes(1, startIndex, outbyte, 0, bufferSize);
while (retval == bufferSize)
{
bw.Write(outbyte);
bw.Flush();
startIndex += bufferSize;
retval = myReader.GetBytes(1, startIndex, outbyte, 0, bufferSize);
}
if (retval>0)
{
bw.Write(outbyte, 0, (int)retval - 1);
}
bw.Flush();
bw.Close();
fs.Close();
}
myReader.Close();
pubsConn.Close();
OracleCommand objOcmd = new OracleCommand("select sopinstanceuid,dicomimage from images where
getdate is not null", objOcon);
FileStream fs;
BinaryWriter bw;
int bufferSize = 30; //方
byte[] outbyte = new byte[bufferSize];
long retval;
long startIndex = 0;
string pub_id = "";
pubsConn.Open();
OracleDataReader myReader = logoCMD.ExecuteReader(CommandBehavior.SequentialAccess);
while (myReader.Read())
{
pub_id = myReader.GetString(0);
fs = new FileStream("c:\\dicomimage\\" +pub_id + ".dcm", FileMode.OpenOrCreate,
FileAccess.Write);
bw = new BinaryWriter(fs);
startIndex = 0;
retval = myReader.GetBytes(1, startIndex, outbyte, 0, bufferSize);
while (retval == bufferSize)
{
bw.Write(outbyte);
bw.Flush();
startIndex += bufferSize;
retval = myReader.GetBytes(1, startIndex, outbyte, 0, bufferSize);
}
if (retval>0)
{
bw.Write(outbyte, 0, (int)retval - 1);
}
bw.Flush();
bw.Close();
fs.Close();
}
myReader.Close();
pubsConn.Close();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询