vb中text保存数据代码问题

来源:百度知道 编辑:UC知道 时间:2024/06/10 19:36:37
Private Sub Command1_Click(Index As Integer)

Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
strcnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/db.mdb;Persist Security Info=False"
cnn.Open strcnn

Set zys = New ADODB.Recordset

zys.Open "轮胎档案", cnn, , , adCmdTable
If (Text1.Text <> "") And (Text2.Text <> "") And (Text3.Text <> "") And (Text4.Text <> "") And (Text5.Text <> "") And (Text6.Text <> "") And (Text7.Text <> "") Then

zys.AddNew
zys! "胎号" = Val(Text1.Text)
zys! "胎型" = Val(Text2.Text)
zys! "当前车辆" = Val(Text3.Text)
zys! "花纹" = Val(Text4.Text)
zys! "单价" = Val(Text5.Text)
zys! "行走公里数" = Val(Text6.Text)
zys! "备注" = Val(Text7.Text)
zys .Update

MsgBox "

不知道你为要将每一个text的内容,都要用val函数
VAL函数是将字符型数据,转换成数值型数据用的,如果你那个字段的内容,不是一个数值型的,那是没有必要用的
至于你说的没有编号的TEXT,请指出具体是哪一行!

没有编号的text 什么意思?