liuwenjun830

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
OracleTransaction myTrans ;
            conn.Open();
            myTrans 
=conn.BeginTransaction(IsolationLevel.ReadCommitted);
            comm.Transaction 
=myTrans;
            comm.CommandText
="insert into TagInfo(TagID,AutoSubSysID,TagCode,TagName,TagType,TagValueType,TagMaxValue,TagMinValue,TagAlartMax";
            comm.CommandText
+="                   ,TagAlartMin,TagSaveInterval,TagSaveIgBand,ValidTerm,TimeStampMode,TagAlartPos";
            comm.CommandText
+="                     ,TagAlartPosDes,Description) ";
            comm.CommandText
+="             values(trim(to_char(SeqTagID.Nextval ,'0000000000')),'0000000100',:TagCode,:TagName,:TagType,:TagValueType,:TagMaxValue,:TagMinValue,:TagAlartMax";
            comm.CommandText
+="                     ,:TagAlartMin,:TagSaveInterval,:TagSaveIgBand,:ValidTerm,:TimeStampMode,:TagAlartPos";
            comm.CommandText
+="                     ,:TagAlartPosDes,:Description)";

            OracleParameter [] parameterValue 
= {
                                                    
new OracleParameter("TagCode",OracleType.VarChar,20)//0
                                                    ,new OracleParameter("TagName",OracleType.VarChar,40)
                                                    ,
new OracleParameter("TagType",OracleType.Char,1)
                                                    ,
new OracleParameter("TagValueType",OracleType.Char,1)
                                                    ,
new OracleParameter("TagMaxValue",OracleType.Double)
                                                    ,
new OracleParameter("TagMinValue",OracleType.Double)
                                                    ,
new OracleParameter("TagAlartMax",OracleType.Double)
                                                    ,
new OracleParameter("TagAlartMin",OracleType.Double)
                                                    ,
new OracleParameter("TagSaveInterval",OracleType.Int32)
                                                    ,
new OracleParameter("TagSaveIgBand",OracleType.Double)
                                                    ,
new OracleParameter("ValidTerm",OracleType.Int32)
                                                    ,
new OracleParameter("TimeStampMode",OracleType.Char,1)
                                                    ,
new OracleParameter("TagAlartPos",OracleType.Int32)
                                                    ,
new OracleParameter("TagAlartPosDes",OracleType.VarChar,40)
                                                    ,
new OracleParameter("Description",OracleType.VarChar,80)
                                                }
;
            
foreach(OracleParameter parameter in parameterValue) comm.Parameters.Add(parameter);

            
int m,n;

            
try
            
{                
                        
                
for(int j=3;j<=30;j++)
                
{
                    m
=j;
                    
for(int i=1;i<12;i++)
                    
{
                        n
=i;
                        
string TagID="";
                        
string TagCode ="00100100010100";
                        
string TagName ="RLS";

                        
//TagCode
                        TagCode +=(j<10)?"0"+j.ToString():j.ToString();
                        TagCode 
+=(i<10)?"000"+i.ToString():"00"+i.ToString();                    
                        parameterValue[
0].Value = TagCode;

                        
//TagName
                        TagName +=(j<10)?"000"+j.ToString():"00"+j.ToString();
                        TagName 
+=(i<10)?"000"+i.ToString():"00"+i.ToString();
                        parameterValue[
1].Value = TagName;

                        
//TagType
                        parameterValue[2].Value =(i<5)? '0':'2';

                        
//TagValueType
                        parameterValue[3].Value=(i==1 || i>=6)?'0':'1';
                                                        
                        
//TagMaxValue
                        if(i==1 ||i==9)
                        
{
                            parameterValue[
4].Value=10000;
                        }

                        
else if(i>=2 && i<6)
                        
{
                            parameterValue[
4].Value=1;
                        }

                        
else if(i==6)
                        
{
                            parameterValue[
4].Value=3600;
                        }

                        
else if(i==7)
                        
{
                            parameterValue[
4].Value=300;
                        }

                        
else if(i==8)
                        
{
                            parameterValue[
4].Value=10;
                        }

                        
else if(i==10)
                        
{
                            parameterValue[
4].Value=DBNull.Value;
                        }

                        
else if(i==11)
                        
{
                            parameterValue[
4].Value=600;
                        }


                        
//TagMinValue
                        if((i>=1 && i<6)||(i>=9 &&i<11))
                        
{
                            parameterValue[
5].Value=0;
                        }

                        
else if(i==6)
                        
{
                            parameterValue[
5].Value=10;
                        }

                        
else if(i==7 ||i==11)
                        
{
                            parameterValue[
5].Value=5;
                        }

                        
else if(i==8)
                        
{
                            parameterValue[
5].Value=2;
                        }

                            
                        
//TagAlartMax
                        parameterValue[6].IsNullable=true;
                        
if((i==1))    parameterValue[6].Value=10000;
                        
else parameterValue[6].Value=DBNull.Value;
                            
                        
//TabAlartMin
                        parameterValue[7].Value =(i==1)?1:0;

                        
//TagSaveInterval
                        if(i==1)
                        
{
                            parameterValue[
8].Value=10000;
                        }

                        
else if(i>=2 && i<=5)
                        
{
                            parameterValue[
8].Value=20000;
                        }

                        
else if(i>5)
                        
{
                            parameterValue[
8].Value=60000;
                        }


                        
//TagSaveIgBand
                        if((i==1))    parameterValue[9].Value=2;
                        
else parameterValue[9].Value=1;
                            
                        
//ValidTerm
                        parameterValue[10].Value =(i==1)?60000:300000;

                        
//TimeStampMode
                        parameterValue[11].Value="0";

                        
//TagAlartPos
                        parameterValue[12].IsNullable=true;
                        
if((i>=1&& (i<=4)) parameterValue[12].Value =0;
                        
else parameterValue[12].Value =DBNull.Value;
                        
//TagAlartPosDes
                        parameterValue[13].Value =(i>=2 && i<=4)?"异常":"";

                        
//Description
                        parameterValue[14].Value ="";

                        comm.ExecuteNonQuery();
posted on 2006-05-26 23:41  偷回忆的人  阅读(10739)  评论(0编辑  收藏  举报