网站导航网学 原创论文 原创专题 网站设计 最新系统 原创论文 论文降重 发表论文 论文发表 UI设计定制 论文答辩PPT格式排版 期刊发表 论文专题
返回网学首页
网学原创论文
最新论文 推荐专题 热门论文 论文专题
当前位置: 网学 > 交易代码 > SQL语法 > 正文

vb学习资料技巧代码打印访问报表数据库常数查询sqlser...

论文降重修改服务、格式排版等 获取论文 论文降重及排版 论文发表 相关服务

【网学网提醒】:本文主要为网学会员提供vb学习资料技巧代码打印访问报表数据库常数查询sqlser...,希望对需要vb学习资料技巧代码打印访问报表数据库常数查询sqlser...网友有所帮助,学习一下!


    '主题绑定到DataGrid
    SubMyTitleBind()
    SqlCommand.Connection=SqlConnection
    SqlCommand.CommandText=selectFileID,FileNamefromDY_UpFileMsgwhereFileType='Subject'
    SqlDataAdapter.SelectCommand=SqlCommand
    SqlDataAdapter.Fill(DataSet,Tbl_Title)
    SqlConnection.Close()
    DataView.Table=DataSet.Tables(Tbl_title)
    Dtg_Title.DataSource=DataView
    EndSub
    '添加主题
    SubMyTitleAdd()
    SqlCommand.Connection=SqlConnection
    SqlCommand.CommandText=select*fromDY_UpFileMsgwhereFileName='&;theTitle&;'andFileType='Subject'
    SqlDataReader=SqlCommand.ExecuteReader()
    IfSqlDataReader.ReadThen
    IfNotPage.IsStartupScriptRegistered(upAlert)Then
    Page.RegisterStartupScript(upAlert,alert('该主题已存在!'))
    EndIf
    Else
    SqlDataReader.Close()
    SqlCommand.CommandText=insertintoDY_UpFileMsg(FileName,FileType)&#118alues('&;theTitle&;','Subject')
    SqlCommand.ExecuteNonQuery()
    IfNotPage.IsStartupScriptRegistered(upAlert)Then
    Page.RegisterStartupScript(upAlert,alert('上传成功!'))
    EndIf
    EndIf
    SqlDataReader.Close()
    EndSub
    '删除主题
    SubMyTitleDelete()
    SqlCommand.Connection=SqlConnection
    SqlCommand.CommandText=DeleteFromDY_UpFileMsgwhereFileID='&;theFileID&;'
    SqlCommand.ExecuteNonQuery()
    IfNotPage.IsStartupScriptRegistered(upAlert)Then
    Page.RegisterStartupScript(upAlert,alert('该主题已被成功的删除了。'))
    EndIf
    Lbl_eer1.Text=删除成功!
    EndSub
    '更新主题
    SubMyTitleUpdate()
    SqlCommand.Connection=SqlConnection
    SqlCommand.CommandText=select*fromDY_UpFileMsgwhereFileName='&;theFileName&;'andFileType='Subject'
    SqlDataReader=SqlCommand.ExecuteReader()
    IfSqlDataReader.ReadThen
    IfNotPage.IsStartupScriptRegistered(upAlert)Then
    Page.RegisterStartupScript(upAlert,alert('该主题已存在!'))
    EndIf
    Lbl_eer1.Text=该主题已存在!
    Else
    SqlDataReader.Close()
    SqlCommand.CommandText=UpdateDY_UpFileMsgsetFileName='&;theFileName&;'whereFileID='&;theFileID&;'
    SqlCommand.ExecuteNonQuery()
    IfNotPage.IsStartupScriptRegistered(upAlert)Then
    Page.RegisterStartupScript(upAlert,alert('主题更新成功!'))
    EndIf
    EndIf
    
    SqlDataReader.Close()
    EndSub
    '页面初始化/显示“添加主题”面板/主题绑定DataGrid
    PrivateSubPage_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load
    IfNotIsPostBackThen
    MyConnectionOpen()
    MyTitleBind()
    MyConnectionClose()
    EndIf
    EndSub
    
    '链接到“文件维护”面板
    PrivateSubLbt_FileMaintenance_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesLbt_FileMaintenance.Click
    Pnl_AddTitle.Visible=False
    Pnl_UpFile.Visible=False
    Pnl_FileMaintenance.Visible=True
    EndSub
    '添加主题/主题绑定到DataGrid
    PrivateSubBtn_AddTitle_ServerClick(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesBtn_AddTitle.ServerClick
    theTitle=Replace(Trim(Txt_Title.&#118alue),','')
    IftheTitle=Then
    Lbl_eer1.Text=请输入主题!
    ExitSub
    EndIf
    MyConnectionOpen()
    MyTitleAdd()
    Dtg_Title.EditItemIndex=-1
    MyTitleBind()
    MyConnectionClose()
    EndSub
    '删除主题/主题绑定DataGrid
    'SubTitle_Delete(ByValsenderAsObject,ByValeAsDataGridCommandEventArgs)
    'EndSub
    PrivateSubDtg_Title_DeleteCommand(ByValsourceAsObject,_
    ByValeAsSystem.Web.UI.WebControls.DataGridCommandEventArgs)HandlesDtg_Title.DeleteCommand
    theFileID=CStr(e.Item.Cells(0).Text)
    MyConnectionOpen()
    MyTitleDelete()
    Dtg_Title.EditItemIndex=-1
    MyTitleBind()
    MyConnectionClose()
    EndSub
    '编辑主题/主题绑定DataGrid
    'SubTitle_Edit(ByValsenderAsObject,ByValeAsDataGridCommandEventArgs)
    'EndSub
    PrivateSubDtg_Title_EditCommand(ByValsourceAsObject,_
    ByValeAsSystem.Web.UI.WebControls.DataGridCommandEventArgs)HandlesDtg_Title.EditCommand
    Dtg_Title.EditItemIndex=e.Item.ItemIndex
    Lbl_eer1.Text=EditReady!!
    MyConnectionOpen()
    MyTitleBind()
    MyConnectionClose()
    EndSub
    '添加Dtg_Title的confirm事件/&#111nmouseout&#111nmouseover事件(mouse事件不知道效果)
    PrivateSubDtg_Title_ItemDataBound(ByValsenderAsObject,ByValeAsSystem.Web.UI.WebControls.DataGridItemEventArgs)HandlesDtg_Title.ItemDataBound
    Ife.Item.ItemType=ListItemType.ItemOre.Item.ItemType=ListItemType.AlternatingItemThen
    DimDTitlebtn_DeleteAsLinkButton
    DTitlebtn_Delete=e.Item.Cells(3).Controls(0)
    DTitlebtn_Delete.Attributes.Add(&#111nclick,&#106avascript:returnconfirm('确定删除该记录吗?');)
    e.Item.Attributes.Add(&#111nmouseover,me.style.backgroundColor='#f3f3f3')
    Ife.Item.Item
    Type=ListItemType.ItemThen
    e.Item.Attributes.Add(&#111nmouseout,me.style.backgroundColor='#E7E7FF')
    Ife.Item.ItemType=ListItemType.AlternatingItemThen
    e.Item.Attributes.Add(&#111nmouseout,me.style.backgroundColor='#F7F7F7')
    EndIf
    EndIf
    EndIf
    EndSub
    '取消编辑主题/主题绑定DataGrid
    'SubTitle_Cancel(ByValsenderAsObject,ByValeAsDataGridCommandEventArgs)
    'EndSub
    PrivateSubDtg_Title_CancelCommand(ByValsourceAsObject,_
    ByValeAsSystem.Web.UI.WebControls.DataGridCommandEventArgs)HandlesDtg_Title.CancelCommand
    Lbl_eer1.Text=EditCancel!
    Dtg_Title.EditItemIndex=-1
    MyConnectionOpen()
    MyTitleBind()
    MyConnectionClose()
    EndSub
    '更新主题/主题绑定DataGrid
    'SubTitle_Update(ByValsenderAsObject,ByValeAsDataGridCommandEventArgs)
    'EndSub
    PrivateSubDtg_Title_UpdateCommand(ByValsourceAsObject,_
    ByValeAsSystem.Web.UI.WebControls.DataGridCommandEventArgs)HandlesDtg_Title.UpdateCommand
    theFileID=CStr(e.Item.Cells(0).Text)
    theFileNameOld=CStr(e.Item.Cells(1).Text)
    DTitleTbx_FileName=CType(e.Item.Cells(1).Controls(0),TextBox)
    theFileName=Replace(Left(Trim(CStr(DTitleTbx_FileName.Text)),30),','')
    MyConnectionOpen()
    MyTitleUpdate()
    Dtg_Title.EditItemIndex=-1
    MyTitleBind()
    MyConnectionClose()
    EndSub
    '更新页面
    'PrivateSubTitle_PageChange(ByValsenderAsObject,ByValeAsDataGridPageChangedEventArgs)
    'EndSub
    PrivateSubDtg_Title_PageIndexChanged(ByValsourceAsObject,_
    ByValeAsSystem.Web.UI.WebControls.DataGridPageChangedEventArgs)_
    HandlesDtg_Title.PageIndexChanged
    Dtg_Title.CurrentPageIndex=e.NewPageIndex
    MyConnectionOpen()
    Dtg_Title.EditItemIndex=-1
    MyTitleBind()
    MyConnectionClose()
    EndSub
    //////
    <%@ImportNamespace="System.Data"%>
    
    
    DataTableCart;
    DataViewCartView;
    ICollectionCreateDataSource(){
    DataTabledt=newDataTable();
    DataRowdr;
    dt.Columns.Add(newDataColumn("IntegerValue",typeof(Int32)));
    dt.Columns.Add(newDataColumn("StringValue",typeof(string)));
    dt.Columns.Add(newDataColumn("DateTimeValue",typeof(DateTime)));
    dt.Columns.Add(newDataColumn("BoolValue",typeof(bool)));
    dt.Columns.Add(newDataColumn("CurrencyValue",typeof(double)));
    for(inti=0;i<9;i++){
    dr=dt.NewRow();
    dr[0]=i;
    dr[1]="Item"+i.ToString();
    dr[2]=DateTime.Now;
    dr[3]=(i%2!=0)?true:false;
    dr[4]=1.23*(i+1);
    dt.Rows.Add(dr);
    }
    DataViewdv=newDataView(dt);
    returndv;
    }
    voidPage_Load(Objectsender,EventArgse)
    {
    if(Session["DG5_ShoppingCart"]==null){
    Cart
    =newDataTable();
    Cart.Columns.Add(newDataColumn("Item",typeof(string)));
    Cart.Columns.Add(newDataColumn("Price",typeof(string)));
    Session["DG5_ShoppingCart"]=Cart;
    }
    else{
    Cart=(DataTable)Session["DG5_ShoppingCart"];
    }
    CartView=newDataView(Cart);
    ShoppingCart.DataSource=CartView;
    CartView.Sort="Item";
    ShoppingCart.DataBind();
    MyDataGrid.DataSource=CreateDataSource();
    MyDataGrid.DataBind();
    }
    voidGrid_CartCommand(objectsender,DataGridCommandEventArgse){
    DataRowdr=Cart.NewRow();
    //e.Itemistherowofthetablewherethecommandfired
    //ForboundcolumnsthevalueisstoredintheTextpropertyofTableCell
    TableCellitemCell=e.Item.Cells[1];
    TableCellpriceCell=e.Item.Cells[2];
    stringitem=itemCell.Text;
    stringprice=priceCell.Text;
    if(((LinkButton)e.CommandSource).CommandName=="AddToCart"){
    dr[0]=item;
    dr[1]=price;
    Cart.Rows.Add(dr);
    }
    else{//RemovefromCart
    CartView.RowFilter="Item='"+item+"'";
    if(CartView.Count>0){
    CartView.Delete(0);
    }
    CartView.RowFilter="";
    }
    ShoppingCart.DataBind();
    }
    
    
    

UsingaTemplateColumninDataGrid


    
    
    
    
    ProductList
        BorderColor="black"
    BorderWidth="1"
    GridLines="Both"
    CellPadding="3"
    CellSpacing="0"
    Font-Name="Verdana"
    Font-Size="8pt"
    HeaderStyle-BackColor="#aaaadd"
    AutoGenerateColumns="false"
    OnItemCommand="Grid_CartCommand"
    >
    
    
    
    
    
    

    

    
    
    
    
    
    

    

    

    

    
    ShoppingCart
        BorderColor="black"
    BorderWidth="1"
    CellPadding="3"
    Font-Name="Verdana"
    Font-Size="8pt"
    HeaderStyle-BackColor="#aaaadd"
    />
    
    
    
    
    
    
    
  • 上一篇资讯: VB学习资料笔记教程
  • 下一篇资讯: VB与SQL语法
  • 设为首页 | 加入收藏 | 网学首页 | 原创论文 | 计算机原创
    版权所有 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2020 myeducs.Cn www.myeducs.Cn All Rights Reserved 湘ICP备09003080号 常年法律顾问:王律师