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() 在黄色的地方出现错误,不知道为什么 哪位能解决。不胜感激!!!