| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 661 人关注过本帖
标题:代号中记录中的内容是刊名,刊名记录中的内容是类别(有图片)
只看楼主 加入收藏
twtdd
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2008-6-12
收藏
 问题点数:0 回复次数:1 
代号中记录中的内容是刊名,刊名记录中的内容是类别(有图片)
Function CreateDataSet(ByVal strSQL As String, ByVal FileName As String, ByVal TableName As String) As DataSet
        Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(FileName)
        Dim objCmd As New OleDbDataAdapter(strSQL, ConnString)
        Dim DS As New DataSet
        objCmd.Fill(DS, TableName)
        CreateDataSet = DS
    End Function
    Sub bindlist()
        DataGrid1.DataSource = CreateDataSet("select top 5 * from book", "mydb.mdb", "book")
        DataGrid1.DataBind()
    End Sub
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not IsPostBack Then bindlist()
    End Sub


  

    Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
        DataGrid1.EditItemIndex = e.Item.ItemIndex
        bindlist()
    End Sub

    Private Sub DataGrid1_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.CancelCommand
        DataGrid1.EditItemIndex = -1
        bindlist()
    End Sub

    Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.UpdateCommand

        Dim dh As String = CType(e.Item.Cells(1).Controls(0), TextBox).Text
        Dim km As String = CType(e.Item.Cells(2).Controls(0), TextBox).Text
        Dim lb As String = CType(e.Item.Cells(3).Controls(0), TextBox).Text
        Dim kq As String = CType(e.Item.Cells(4).Controls(0), TextBox).Text
        Dim strSQL As String
        strSQL = "update book set 代号=' " & dh & " ',刊名=' " & km & " ',类别=' " & lb & " ',刊期=' " & kq & " 'where " & DataGrid1.DataKeyField & "=" & DataGrid1.DataKeys(e.Item.ItemIndex)
        Dim objconn As New OleDbConnection
        objconn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & Server.MapPath("mydb.mdb")
        objconn.Open()
        Dim objcmd As New OleDbCommand(strSQL, objconn)
        objcmd.ExecuteNonQuery()
        DataGrid1.EditItemIndex = -1
        bindlist()
    End Sub
End Class

[[it] 本帖最后由 twtdd 于 2008-6-15 15:41 编辑 [/it]]

未命名.jpg (14.01 KB)
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: 刊名 类别 Microsoft 代号 String 
2008-06-15 15:38
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 
ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs

的内容吧?
你想表达什么?
2008-06-15 16:39
快速回复:代号中记录中的内容是刊名,刊名记录中的内容是类别(有图片)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.037574 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved