gds通用软件开发系统

导航

codebak

////获取数据源连接方式
//string tsql = "select top 1  isnull(coded,'') coded ,isnull(sqlstr,'')  sqlstr "
//    + " ,loc_con,loc_sql " + " from cwfsys_workfield where objname='" + field + "' and worktable='" + worktable + "'";
//DataTable mydtsql = dbbase.cwfData_GetDataTable(tsql);
//if (mydtsql != null && mydtsql.Rows.Count > 0)
//{
//    DataTable mydtvar = cwfIosys.dataCtrl.GetZipDataTable(bcons);
//    string lcon = mydtsql.Rows[0]["loc_con"].ToString();
//    if (string.IsNullOrEmpty(lcon) == false)
//    {
//        lcon = cwfIosys.dataCtrl.ParseSql(lcon, mydtvar);
//        DataTable mydtcon = dbbase.cwfData_GetDataTable(lcon);
//        if (mydtcon != null && mydtsql.Rows.Count > 0)
//        {
//            string dburl = mydtcon.Rows[0]["cnstr"].ToString();
//            string dbtype = mydtcon.Rows[0]["dbtype"].ToString();
//            if (string.IsNullOrEmpty(dburl) == false)
//            {
//                string cmdsql = mydtsql.Rows[0]["sqlstr"].ToString();
//                cmdsql = cwfIosys.dataCtrl.ParseSql(cmdsql, mydtvar);
//                if (string.IsNullOrEmpty(cmdsql) == false)
//                {
//                    //判断是否是sql语句 如果是执行sql语句,否则执行外部工作表
//                    //包括select ,exec,update ,insert ,delete
//                    if (cmdsql.Contains("select") == true || cmdsql.Contains("exec ") == true || cmdsql.Contains("update ") == true || cmdsql.Contains("insert ") == true || cmdsql.Contains("delete ") == true || cmdsql.Contains("dbcc ") == true)
//                    {
//                        string errmsg;
//                        DataSet mydsreg = cwfAppData.appDataLoc.Get_dataSet(dburl, dbtype, cmdsql, out errmsg);
//                        if (string.IsNullOrEmpty(errmsg) == false)
//                        {
//                            mydsreg = new DataSet("errmsg");
//                            DataTable mydt1 = new DataTable();
//                            mydt1.TableName = "cwfdberr";
//                            mydt1.Columns.Add("DataErrorMsg");
//                            mydt1.Rows.Add(new object[] { errmsg });
//                            mydsreg.Tables.Add(mydt1);
//                        }
//                        else
//                        {
//                            return mydsreg;
//                        }
//                    }
//                    else
//                    {
//                        return CwfDataOut_CwfWorkData(dburl, cmdsql, mydtvar, encrypt, strkey);
//                    }
//                }
//            }
//        }
//    }
//}
//return null;

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