哪位大牛 帮看看有没有逻辑错误

// 图片处理Dlg.cpp : 实现文件

//

 

#include "stdafx.h"

#include "图片处理.h"

#include "图片处理Dlg.h"

#include "MyWrapperAdo.h"

 

 

 

void C图片处理Dlg::OnBnClickedButton1()

{

     //TODO: 在此添加控件通知处理程序代码

     CString count1,count2;

     intzongshu1,zongshu2;

     inti;

     intj;

     CString oldpath1,oldpath2;

     CString newpath1,newpath2;

     CString strOrderNO;

     CString strTime =strOrderNO.Mid(4,8);

     CString strQuery1= "";

     CString strQuery2= "";

     longnTemplateID =0 ;

     longnOrderNum = 0;

     longnProductID = 0;

     longnOrderProductID = 0;

     longnPhotoID = 0;

     longnOrderPhotoID = 0;

     longnPhotoNum = 0 ;

     longnIsjq = 0 ;

     longnIsgm = 0 ;

     longnIstl = 0 ;

     CString strPhotoPath = "";

     CString strDisk = "";

     CString strPhotoName = "";

     CString strProductName = "";

     CString strProductType = "";

     CString strIsjq = "";

     CString strIsgm = "";

     CString strIstl = "";

     CString strRename1 = "";

     CString strRename2 = "";

     CString strTemplateTitle = "";

     CString  strPhotoInfo = _T("");

     CString strNewOrOld = _T("");

     CString strUserId = _T("");

     CString strTmp2 = "";

     intnPos = 0;

     intnPhotoFlag = 0;

     //连接数据库

     CMyWrapperAdo *mydb = new CMyWrapperAdo(CBasicAdo::GetBasicInstance());

     //设置路径

     CString connectlujing;

     connectlujing="Provider = OraOLEDB.Oracle.1;Persist SecurityInfo=True;Data Source =o****;User Id=*******;Password=******* ";

     //连接数据库

     mydb->ConnectiontoDB(connectlujing,ADODB::adOpenUnspecified);

     //获得未处理图片数量

     //对照片处理

     CString select1;

     CString select11;

     select1="selectcount(a.orderno) as tatol  from ordersa,orderproducts b where a.orderno  =b.orderno and  b.producttype='尺寸' anda.status='未冲印'";

     select11="select a.orderno  fromorders a,orderproducts b where a.orderno = b.orderno and  b.producttype='尺寸' anda.status='未冲印'";

     mydb->Open(select1);

     mydb->GetCollect("tatol",count1);

     //强制类型转换

     zongshu1=atoi(count1);

     mydb->Open(select11);//得到订单号

 

     //对图片重命名移动

     for(i=1;i<=zongshu1;i++)

     {

 

 

         mydb->GetCollect("orderno", strOrderNO);

 

         //获得图片全部信息

         strQuery1.Format("selectphotos.photopath,photos.disk,photos.photoname,photos.photoid,orderphotos.photonum,products.productname,products.ordernum,\

                             products.productid,products.producttype,products.orderproductid,orderphotos.isjq,orderphotos.isgm,orderphotos.istl,orderphotos.orderphotoid \

                             from orderproducts products, orderphotos,photos where products.orderproductid = orderphotos.orderproductid\

                             and photos.photoid = orderphotos.photoid andproducts.producttype='尺寸' and products.orderno='%s'",strOrderNO);

 

         mydb->Open(strQuery1);

         if(mydb->IsEOF()== false)//是否为空

         {//路径

              mydb->GetCollect("disk",strDisk);

              mydb->GetCollect("photopath",strPhotoPath);

              mydb->GetCollect("photoname",strPhotoName);

 

              mydb->GetCollect("ordernum",nOrderNum);

              mydb->GetCollect("productid",nProductID);

              mydb->GetCollect("orderproductid",nOrderProductID);

              mydb->GetCollect("photoid",nPhotoID);

              mydb->GetCollect("photonum",nPhotoNum);

              mydb->GetCollect("isjq",nIsjq);

              mydb->GetCollect("isgm",nIsgm);

              mydb->GetCollect("istl",nIstl);

              mydb->GetCollect("productname",strProductName);

              mydb->GetCollect("orderphotoid",nOrderPhotoID);

 

 

              oldpath1.Format("%s%s%s",strDisk,strPhotoPath,strPhotoName);

              //重命名

              CString strTmp = _T("");

              strTmp =strPhotoName.Left( strPhotoName.GetLength()-4 );

              switch (nIsgm)

              {

              case 1:

                   strIsgm = _T("光面");

                   break;

              case 2:

                   strIsgm = _T("麻面");

                   break;

              }

 

              switch (nIstl)

              {

              case 1:

                   //   strIstl ="";

                   break;

              case 2:

                   strIstl = _T("调亮");

                   break;

              case 3:

                   strIstl = _T("不调亮");

                   break;

              }

 

              switch (nIsjq)

              {

              case 1:

                   //strIsjq = "";

                   break;

              case 2:

                   strIsjq = _T("裁切");

                   break;

              case 3:

                   strIsjq = _T("留白");

                   break;

              }

 

 

              strRename1.Format("%s/%s/%s_%d张_%d_%d_%s_%s_%s_%sa.jpg",strTime,strOrderNO,strProductName,nPhotoNum,nOrderProductID,\

                   nOrderPhotoID,strTmp, strIsjq, strIstl, strIsgm);

 

              newpath1.Format("Y:/%s%s",strPhotoPath,strRename1);

              //路径拆分

              CString lift;

              lift=strPhotoPath.Left(9);

 

              //创建文件夹(根据路径)

              //一级路径

              CString yiji;

              yiji.Format("Y:/%s",lift);

 

              DWORD dwAttr =GetFileAttributes(strPhotoPath);

              if (dwAttr == 0xFFFFFFFF)

              {

                   //不存在

                   CreateDirectory(yiji,NULL);

                   CreateDirectory(strPhotoPath,NULL);

                   //复制文件

 

                   CopyFile(oldpath1,newpath1,3);

                   //改字段

                   CString ziduan1;

                   ziduan1.Format("updata orders SET status='已上传' whereorderno='%s'",strOrderNO);

                   mydb->Open(ziduan1);

 

                   mydb->MoveNext();

 

              }

              else

              {

                   //存在

                   CopyFile(oldpath1,newpath1,3);

                   //改字段

                   CString ziduan1;

                   ziduan1.Format("updata orders SET status='已上传' whereorderno='%s'",strOrderNO);

                   mydb->Open(ziduan1);

 

                   mydb->MoveNext();

 

              }

 

 

 

 

 

         }

     }

     //对增值产品的操作

     CString select2;

     CString select22;

     select2="selectcount(a.orderno) as tatol  from ordersa,orderproducts b where a.orderno  =b.orderno and  b.producttype='增值' anda.status='未冲印'";

     select22="select a.orderno  fromorders a,orderproducts b where a.orderno = b.orderno and  b.producttype='增值' anda.status='未冲印'";

     mydb->Open(select2);

     mydb->GetCollect("tatol",count2);

 

     //强制类型转换

     zongshu2=atoi(count2);

     mydb->Open(select22);//得到订单号

     for(j=1;j<=zongshu2;j++)

     {

 

 

         mydb->GetCollect("orderno", strOrderNO);

 

         strQuery2.Format("selectphotos.photopath,photos.disk,photos.photoname,photos.photoid,orderphotos.photonum,\

                             products.productname,products.ordernum,  products.productid,products.producttype,\

                             products.orderproductid,title.title,title.neworold,orderphotos.orderphotoid,orderphotos.info\

                             from orderproductsproducts,orderphotos,photos,template_title title \

                             whereproducts.orderproductid=orderphotos.orderproductid\

                             and photos.photoid = orderphotos.photoid andproducts.producttype='增值'\

                             and products.template_id = title.title_id(+)and products.orderno='%s'",strOrderNO);

 

 

         mydb->Open(strQuery2);

         if(mydb->IsEOF()== false)

         {//加载信息

              mydb->GetCollect("ordernum",nOrderNum);

              mydb->GetCollect("productid",nProductID);

              mydb->GetCollect("orderproductid",nOrderProductID);

              mydb->GetCollect("orderphotoid",nOrderPhotoID);

              mydb->GetCollect("photonum",nPhotoNum);  

              mydb->GetCollect("photoname",strPhotoName);

              mydb->GetCollect("photopath",strPhotoPath) ;

              mydb->GetCollect("productname",strProductName);

              mydb->GetCollect("title",strTemplateTitle);

              mydb->GetCollect("info",strPhotoInfo);

              mydb->GetCollect("disk",strDisk);

              mydb->GetCollect("neworold",strNewOrOld);

 

              oldpath2.Format("%s%s%s",strDisk,strPhotoPath,strPhotoName);

              //重命名

              if (strTemplateTitle == "")

              {

                   strTemplateTitle="不使用模板";

              }

 

 

              strRename2.Format("%s/%s/%s_%d张_%d_%s_%s_%d_%s_%s",strTime,strOrderNO,strProductName,nOrderNum,nOrderProductID,

                   strNewOrOld,strTemplateTitle,nOrderPhotoID,strPhotoInfo,strPhotoName);

 

              newpath2.Format("Y:/%s%s",strPhotoPath,strRename2);

 

 

 

 

              //路径拆分

              CString lift2;

              lift2=strPhotoPath.Left(9);

              CString yiji2;

              yiji2.Format("Y:/%s",lift2);

              //创建文件夹(根据路径)

              DWORD dwAttr =GetFileAttributes(strPhotoPath);

              if (dwAttr == 0xFFFFFFFF)

              {

                   CreateDirectory(yiji2,NULL);

                   CreateDirectory(strPhotoPath,NULL);

                   //复制文件

                   CopyFile(oldpath2,newpath2,3);  

                   //改字段

                   CString ziduan2;

                   ziduan2.Format("updata orders SET status='已上传' whereorderno='%s'",strOrderNO);

                   mydb->Open(ziduan2);

                   mydb->MoveNext();

 

 

              }

              else

              {

                   //复制文件

                   CopyFile(oldpath2,newpath2,3);  

                   //改字段

                   CString ziduan2;

                   ziduan2.Format("updata orders SET status='已上传' whereorderno='%s'",strOrderNO);

                   mydb->Open(ziduan2);

                   mydb->MoveNext();

 

 

              }

 

 

 

 

 

 

 

 

 

 

         }

     }

 

 

}

阅读更多

C#无法调用OCX控件,哪位大牛看看

09-21

小弟对OCX原理等不熟,只知是ActiveX的一种,对于C#调用OCX也只是简单知道一点,但现在有一个OCX控件却无法调用,网上搜索了很多都是无法解决,包括了以下两方式:rn第一方式:手动管理员CMD下regsvr32注册,再用aximp来生成dll供VS2010调用;可以正常注册,但用aximp时会提示如下的错误信息:rn“AxImp 错误: 加载类型库/DLL 时出错。 (异常来自 HRESULT:0x80029C4A (TYPE_E_CANTLOArnDLIBRARY))”rn第二种方式:在VS2010中以添加控件的方式来导入该控件,控件可以导入到工具箱中,如下图所示:rn[img=http://img.bbs.csdn.net/upload/201309/21/1379735393_1206.jpg][/img]rn但将其(工具箱中的那三个都试过)施放到WinForm界面时却出现如下图的提示rn[img=http://img.bbs.csdn.net/upload/201309/21/1379735317_676200.jpg][/img]rn而且也试过先注册,再重新执行该种(即第二种)方式,同样出现上边的情况。rnrn此时注意到了项目右边的该OCX的两个引用打着“!”号,如下图所示:rn[img=http://img.bbs.csdn.net/upload/201309/21/1379735477_757344.jpg][/img]rnrn哪位大牛能帮忙的或是有想挑战一下如何解决此问题的大侠,可以去我的网盘下载该OCX控件然后自己调试下看看:[url=http://qty201301.ys168.com/][/url](文件夹“C#无法调用的OCX下载”里面放的压缩包就是了)rnrn[color=#FF0000][b]能帮忙解决此问题的,小弟不成敬意,100分送上! 大牛在哪里啊??[/b][/color]

分页错误,帮看看

09-10

rn说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 rnrn编译器错误信息: CS0120: 非静态的字段、方法或属性“System.Web.UI.WebControls.DataGrid.CurrentPageIndex”要求对象引用rnrn源错误:rnrn rnrn行 203: rn行 204: void DataGrid1_SelectedIndexChanged(object sender, EventArgs e) rn行 205: DataGrid.CurrentPageIndex=e.NewPageIndex;rn行 206: DataBind();rn行 207: rn rnrn源文件: E:\wwwroot\test_2.aspx 行: 205 rnrnrnrn显示详细的编译器输出:rnrnrnC:\WINNT\system32> "c:\winnt\microsoft.net\framework\v1.1.4322\csc.exe" /t:library /utf8output /R:"c:\winnt\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll" /R:"c:\winnt\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll" /R:"c:\winnt\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll" /R:"c:\winnt\microsoft.net\framework\v1.1.4322\mscorlib.dll" /R:"c:\winnt\assembly\gac\system.web\1.0.5000.0__b03f5f7f11d50a3a\system.web.dll" /R:"c:\winnt\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll" /R:"c:\winnt\assembly\gac\system.web.services\1.0.5000.0__b03f5f7f11d50a3a\system.web.services.dll" /R:"c:\winnt\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll" /R:"c:\winnt\assembly\gac\system.web.mobile\1.0.5000.0__b03f5f7f11d50a3a\system.web.mobile.dll" /out:"C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\matrixtur\51e4a29f\f8096ab8\1coh0h68.dll" /D:DEBUG /debug+ /optimize- /warnaserror /w:1 "C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\matrixtur\51e4a29f\f8096ab8\1coh0h68.0.cs"rnrnrnMicrosoft (R) Visual C# .NET 编译器版本 7.10.3052.4rn用于 Microsoft (R) .NET Framework 版本 1.1.4322rn版权所有 (C) Microsoft Corporation 2001-2002。保留所有权利。rnrnE:\wwwroot\test_2.aspx(205,9): error CS0120: 非静态的字段、方法或属性“System.Web.UI.WebControls.DataGrid.CurrentPageIndex”要求对象引用rnE:\wwwroot\test_2.aspx(205,35): error CS0117: “System.EventArgs”并不包含对“NewPageIndex”的定义rnrn rn

没有更多推荐了,返回首页