1.
string cnnstring = System.Configuration.ConfigurationSettings.AppSettings["Oracle"].ToString();
OracleConnection conn=new OracleConnection(cnnstring);
OracleCommand cmd=new OracleCommand("select spxxid,spdt from jt_j_spxx where spdt is not null order by spxxid desc ",conn);
//OracleCommand cmd=new OracleCommand("select spxxid,spdt from jt_j_spxx order by spxxid desc ",conn);
//OracleCommand cmd=new OracleCommand("select spxxid,spdt from jt_j_spxx where spxxid='756336553'",conn);
conn.Open();
OracleDataReader myReader;
myReader = cmd.ExecuteReader();
while(myReader.Read())
{
fpath = Server.MapPath(Request.ApplicationPath)+"/image/"+myReader.GetString(0)+".jpg";
fs =new FileStream(fpath, FileMode.OpenOrCreate, FileAccess.Write);
bw = new BinaryWriter(fs);
outbyte = (byte[])myReader[1];
bw.Write(outbyte);
bw.Flush();
bw.Close();
fs.Close();
}
myReader.Close();
conn.Close();
2.
upfile(System.Configuration.ConfigurationSettings.AppSettings["ForumUrl"]+"/Movie/default.aspx","~/Movie/index.html");
public void upfile(string url,string mappath)
{
try
{
Uri UrlPage= new Uri(url);
HttpWebRequest hwReq = (HttpWebRequest)WebRequest.Create(UrlPage);
hwReq.Timeout = 50000 ;
HttpWebResponse hwRes = (HttpWebResponse)hwReq.GetResponse();
hwReq.Method = "Post";
hwReq.KeepAlive = true;
StreamWriter fs =new StreamWriter(Server.MapPath(mappath),false,System.Text.Encoding.UTF8);
StreamReader fs2=new StreamReader(hwRes.GetResponseStream(),System.Text.Encoding.UTF8);
string nextline;
while((nextline=fs2.ReadLine())!=null)
{
fs.WriteLine(nextline);
}
fs.Close();
fs2.Close();
Response.Write("<script>alert('生成成功');</script>");
}
catch
{
Response.Write("<script>alert('生成超时,请重新生成');</script>");
}
}
3.
if(File.Exists(Server.MapPath("../zthtml/temp/"+str))==false)
{
Response.Write("<script>alert('没有找到模板,请确定模板的名字正确!');</script>");
}
else
{
StreamReader objReader = new StreamReader(Server.MapPath("~/zthtml/temp/"+str),System.Text.Encoding.GetEncoding("gb2312"));
string sLine="";
sLine=objReader.ReadToEnd();
objReader.Close();
}StreamWriter sw=new StreamWriter(Server.MapPath("~/zthtml/"+str.Substring(0,str.IndexOf(".",1))+".shtml"),false,System.Text.Encoding.GetEncoding("gb2312"),sLine.Length);
sw.Write(sLine);