0

我使用了这样的命名方法:

ds.Tables("Employees").Rows.Add(ENumTxt.Text, ENameTxt.Text,PosTxt.Text,EAgeTxt.Text,_
ESalTxt.Text, EPhonTxt.Text, EAdrsTxt.Text)
If ds.HasChanges Then
            Dim AffectedDS As DataSet = ds.GetChanges(DataRowState.Added)
            Dim ComBuilder As New OleDb.OleDbCommandBuilder(da)
            da.InsertCommand = ComBuilder.GetInsertCommand()
            da.Update(AffectedDS, "Employees")
End If

但是当我在运行时检查插入命令时,它看起来像:

插入员工价值观(?,?,?,?,?,?,?)

我在文本框中输入的值在哪里?

4

2 回答 2

2

它们可能在 InserCommand 的参数集合中。查看 da.InsertCommand.Parameters。

于 2009-03-31T13:12:41.010 回答
0

尝试向参数添加值,例如):

adapter.InsertCommand.Parameters["@p1"].Value = // some value
adapter.InsertCommand.Parameters["@p2"].Value = // some value
adapter.InsertCommand.Parameters["@p3"].Value = DBNull.Value // if you need to pass a null;

参数应与数据库表字段的顺序相匹配。

您还需要执行插入命令的查询:

adapter.InsertCommand.ExecuteNonQuery();
于 2015-07-07T13:11:17.490 回答