有关组合框无法完成数据绑定、参数如何传递更新?

[复制链接]
查看11 | 回复0 | 2005-4-13 11:51:00 | 显示全部楼层 |阅读模式
有关组合框无法完成数据绑定,VB.NET2003向导生成的窗体
================================================================
VB.NET2003的数据窗体向导可以自动完成文本框的数据绑定,并向下面的代码提供参数
Me.OleDbDataAdapter1.InsertCommand = Me.OleDbInsertCommand1
'OleDbInsertCommand1
'
Me.OleDbInsertCommand1.CommandText = "INSERT INTO A_PERSON(CPERSONCODE, CPERSONNAME, CDEPCODE, CPERSONPROP, CPERSONEMAI" & _
"L, CPERSONPHONE, BBFLAG) VALUES (?, ?, ?, ?, ?, ?, ?)"
Me.OleDbInsertCommand1.Connection = Me.OleDbConnection1
Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("CPERSONCODE", System.Data.OleDb.OleDbType.VarWChar, 8, "CPERSONCODE&quot

)
Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("CPERSONNAME", System.Data.OleDb.OleDbType.VarWChar, 20, "CPERSONNAME&quot

)
Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("CDEPCODE", System.Data.OleDb.OleDbType.VarWChar, 12, "CDEPCODE&quot

)
Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("CPERSONPROP", System.Data.OleDb.OleDbType.VarWChar, 10, "CPERSONPROP&quot

)
Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("CPERSONEMAIL", System.Data.OleDb.OleDbType.VarWChar, 30, "CPERSONEMAIL&quot

)
Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("CPERSONPHONE", System.Data.OleDb.OleDbType.VarWChar, 20, "CPERSONPHONE&quot

)
Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("BBFLAG", System.Data.OleDb.OleDbType.VarNumeric, 0, System.Data.ParameterDirection.Input, False, CType(38, Byte), CType(0, Byte), "BBFLAG", System.Data.DataRowVersion.Current, Nothing))
'
说明: 表A_PERSON有7个字段,先定义了insert语句的commandtext,其Parameters由后面的七个语句提供,来源于窗体上的文本框数据绑定
问题:我希望把CDEPCODE这个字段,修改为组合框,其值为A_DEPARTMENT表的检索结果,如下所示
with me.comboBox1

.datasource=表A_DEPARTMENT

.displaymember="DepID"
'部门编码

.valuemember="DepName"
'部门名称
end with
如何由这个组合框向前面的insertCommand传递Parameters?

================================================================
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行