标题:如何把dataset增加一行后提交数据库
取消只看楼主
23760639
Rank: 1
等 级:新手上路
帖 子:277
专家分:0
注 册:2005-5-13
 问题点数:0 回复次数:0 
如何把dataset增加一行后提交数据库

Dim com As New SqlCommand Dim ds As New DataSet Dim adp As New SqlDataAdapter com.Connection = SqlConnection2 adp.SelectCommand = com SqlConnection2.Open() com.CommandText = "select * from customers" ds.Clear() adp.Fill(ds, "tb1")

Dim cb As SqlCommandBuilder = New SqlCommandBuilder(adp) Dim dt As DataTable

dt = ds.Tables("tb1") Dim dr As DataRow dr = dt.NewRow dr(0) = "OTISP" dr(1) = "up" dt.Rows.Add(dr) DataGrid3.DataSource = ds.Tables("tb1") Dim drm As DataRow() = ds.Tables("tb1").Select(Nothing, Nothing, DataViewRowState.Added)

adp.Update(drm) SqlConnection2.Close() 在黄色的地方出现错误,不知道为什么 哪位能解决。不胜感激!!!

搜索更多相关主题的帖子: 数据库 dataset 
2005-05-14 15:13



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




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

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