gds通用软件开发系统

导航

把照片写入到DataTable

if (mydtzybr.Columns.Contains("image1") == true && mydtzybr.Columns.Contains("imgfile") == true)
{
    string filename, filefull;
    for (int i = 0; i < mydtzybr.Rows.Count; i++)
    {
        filename = mydtzybr.Rows[0]["image1"].ToString();
        if (string.IsNullOrEmpty(filename) == false)
        {
            if (string.Compare(db_type, "db") == 0)
            {
                filefull = Application.StartupPath + @"\uploadfile\" + filename;
                if (System.IO.File.Exists(filefull) == true)
                {
                    try
                    {
                        mydtzybr.Rows[0]["imgfile"] = cwfIosys.ioCtrl.ReadFile(filefull);
                    }
                    catch (Exception cw)
                    {
                        appctrl.lastErrorlev = 2;
                        appctrl.lastError = cw.Message;
                        appctrl.WriteErrLog(cw.Message, "写入住院病人图像数据");
                        appctrl.appruninglog.addlog("写入住院病人图像数据失败!" + cw.Message);
                    }
                }
            }
        }
    }
    mydtzybr.AcceptChanges();
}

posted on 2010-06-19 15:52  gds通用软件开发系统  阅读(169)  评论(0编辑  收藏  举报