bcjq024.txt

来自「c++ builder 的一些txt文档」· 文本 代码 · 共 317 行

TXT
317
字号

C++ Builder开发者:程序员之家
var how_many_ads = 3;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % how_many_ads;
ad +=1;
 
  
  
    
      
        
          
            首页   
              | 控件天堂 | 控件使用                   
              | 编程技巧                    
              |  源代码 |  编程工具 |        
               系统补丁 |  电子书籍 | 技术论坛                    
              |  相关链接                 
                           
                         
                       
                     
                     
                       
                         
                           
                             
                           
                 
       if (ad==1) {document.write(''+'');}               
       if (ad==2) {document.write(''+'');}               
       if (ad==3) {document.write(''+'');}               
                              
                           
                        
                                    
                        
                      
                    
                  
                  
                    
                      
                        
                          
                       
                     
var marqueecontents=''+scroll_text+''           
if (document.all)           
document.write(''+marqueecontents+'')           
function regenerate(){           
window.location.reload()           
}           
function regenerate2(){           
if (document.layers){           
setTimeout("window.onresize=regenerate",450)           
intializemarquee()           
}           
}           
function intializemarquee(){           
document.cmarquee01.document.cmarquee02.document.write(marqueecontents)           
document.cmarquee01.document.cmarquee02.document.close()           
thelength=document.cmarquee01.document.cmarquee02.document.height           
scrollit()           
}           
function scrollit(){           
if (document.cmarquee01.document.cmarquee02.top>=thelength*(-1)){           
document.cmarquee01.document.cmarquee02.top-=speed           
setTimeout("scrollit()",100)           
}           
else{           
document.cmarquee01.document.cmarquee02.top=marqueeheight           
scrollit()           
}           
}           
window.onload=regenerate2           
                       
                         
                       
                     
                   
                 
                 
                   
                     
                       
                         
                           
                             
                               
                  当前位置
    
    
                    编程技巧            
                            
                          
                        
                        
                        
                          
                            
                              
                    BCB实现BLOB字段的读写        
                          
                    
                      
                        
                          
                          对于SQL中的TEXT、IMAGE、MEMO字段的存取,可以采用下列程序:
            BLOB字段的读取:
            TBlobSTream* TemplateStream;
 
            char* TempPlatePtr;
 
            
 
            TemplateStream=new TBlobStream((TBlobField*)WebQuery->FieldByName
 
            ("SearchTem"),bmReadWrite);
 
            TemplatePtr= new char[TemplateStream->Size];
 
            TemplateStream->Read(TemplatePtr, TemplateStream->Size);
 
            
 
            BLOB字段的写入:
 
            TBlobSTream* TemplateStream;
 
            char* TempPlatePtr;
 
            
 
            TemplateStream=new TBlobStream((TBlobField*)WebQuery->FieldByName
 
            ("SearchTem"),bmReadWrite);
 
            TemplatePtr= new char[TemplateStream->Size];
 
            TemplateStream->Write(TemplatePtr, TemplateStream->Size);
 
            
 
            ________________________________________________________________
 
            补充:
 
            获得字段的大小用函数datalength
 
            
 
            SQL Server端要作一点设置:
 
            By default, WRITETEXT is a nonlogged operation. This means that
 
            text or image data is not logged when it is written into the  
            database.
 
            To use WRITETEXT in its default, nonlogged state,
 
            //注意!!
 
            the system administrator must use the sp_dboption system stored
 
            procedure to set select into/bulkcopy,
 
            //
 
            which allows nonlogged data to be inserted.
 
            
 
            做了试验,直接写SQL语句好象不行.
 
            ____________________________________________________________________
 
            一些注意事项和一个例子
 
            在写入时:
 
            (1)如果使用的是TTable,则要将其ReadOnly属性先置为false,然后调用Edit函数;
 
            (2)如果使用的是TQuery,则要将其RequestLive属性先置为true,然后调用Edit函数;
 
            使得TTable(TQuery)是可写的.
 
            
 
            下面是一个使用TQuery往content表(主键file_id)中插入一条记录的例子,
 
            script为一个BLOB字段:
 
            TBlobStream *pScriptStream;
 
            //插入一条记录
 
            strSQL1="insert into content(file_id,script,key_image)  
            values('";
 
            strSQL1=strSQL1+m_szFileID+"',null,null)";
 
            dmStoryEditor->qryExec->SQL->Clear();
 
            dmStoryEditor->qryExec->SQL->Add(strSQL1);
 
            dmStoryEditor->qryExec->ExecSQL();
 
            dmStoryEditor->qryExec->Close();
 
            //整理要写入的Blob数据
 
            LockMemories(NewsScript);
 
            NewsScript.GetEdition(NewsScript.m_ScriptHead.byteEditionNum);
 
            NewsScript.m_pScript=(BYTE *)GlobalLock(NewsScript.m_hScript);
 
            if(NewsScript.m_pScript!=NULL)
 
            {
 
            //再将刚插入的记录读出来,使该Query与该条记录关联
 
            strSQL1="select file_id,script from content where  
            file_id='"+
 
            m_szFileID+"'";
 
            //允许该Query写
 
            dmStoryEditor->qryExec->RequestLive=true;
 
            dmStoryEditor->qryExec->SQL->Clear();
 
            dmStoryEditor->qryExec->SQL->Add(strSQL1);
 
            dmStoryEditor->qryExec->Open();
 
            dmStoryEditor->qryExec->First();
 
            //将该Query置为可写
 
            dmStoryEditor->qryExec->Edit();
 
            pScriptStream=new TBlobStream((TBlobField*)dmStoryEditor->
 
            qryExec->FieldByName("script"),bmReadWrite);
 
            pScriptStream->Write(NewsScript.m_pScript,
 
            NewsScript.m_lScriptRealSize);
 
            dmStoryEditor->qryExec->Post();
 
            dmStoryEditor->qryExec->RequestLive=false;
 
            delete pScriptStream;
 
            }
 
            GlobalUnlock(NewsScript.m_hScript);
 
            UnLockMemories(NewsScript);     
                             
                           
                               
                       
                             
                               
                             
                  if (ad==1) {document.write(''+'');}             
                  if (ad==2) {document.write(''+'');}             
                  if (ad==3) {document.write(''+'');}             
                                               
                             
                           
                         
                       
                  
                   
                     
                       
                     
                     
                         
                     
                   
                      
                    
                  
                
              
              
                
                  
                    
                      
            C++ Builder开发者®           
              2000年06月01日 站长:唐朝           
                     
                   
                 
               
               
                 
               
             
             
           
           
           
           

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?