标题:代号中记录中的内容是刊名,刊名记录中的内容是类别(有图片)
只看楼主
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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-219294-1-1.html




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

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