代码是这样的:
Private Sub Command1_Click()
cnnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=order.mdb;Persist Security Info=False"
str = "select * from main"
db.Open cnnstr
dbrs.Open str, db, adOpenDynamic, adLockOptimistic
With dbrs
.AddNew
!custom_name = custom_name.Text
!custom_type = custom_type_value
!ic_type = ic_type_value
!con_name = con_name.Text
!cer_type = cer_type_value
!post_type = post_type_value
!cer_no = cer_no.Text
!custom_addr = custom_addr.Text
!mailcode = mailcode.Text
!email = email.Text
!phone = phone.Text
!fax = fax.Text
!area1 = area1.Text
!area2 = area2.Text
!org_code = org_code.Text
!cal = cal_value
!bank = bank_value
!bank_no = bank_no.Text
!book_type = book_type.Text
!buss_reg = buss_reg.Text
!tux_no = tux_no.Text
!inv_type = inv_type_value
!oil_type = oil_type_value
!car_no = car_no.Text
!day_add = day_add.Text
!day_pay = day_pay.Text
!l_day = l_day.Text
!area_station = area_station.Text
!custom_no = custom_no.Text
!main_card_no = main_card_no.Text
!gil_no = gil_no.Text
!intro = intro.Text
!first_charge = first_charge.Text
!lg_f = lg_f.Text
!cw_f = cw_f.Text
!qg_f = qg_f.Text
!fjl_f = fjl_f.Text
!jl_f = jl_f.Text
.Update
End With
MsgBox ("添加成功")
dbrs.Close
db.Close
End Sub
用这段代码向数据库插入数据的时候,有的操作系统可以添加成功,但有的系统会提示80040e21
-2147217887错误,请问这是怎么回事?
说明:ic_type_value等变量都是用来储存OptionButton.caption的值的,但有可能为空,
数据库里的每一个字段都允许空字符,类型为文本
顺便问一下大家,在1024*768下设计的mdi窗体,如果用800*600的分辨率去打开的话,会有部分显示不了,可以在父窗体中用滚动条把子窗体显示完整吗?
Private Sub Command1_Click()
cnnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=order.mdb;Persist Security Info=False"
str = "select * from main"
db.Open cnnstr
dbrs.Open str, db, adOpenDynamic, adLockOptimistic
With dbrs
.AddNew
!custom_name = custom_name.Text
!custom_type = custom_type_value
!ic_type = ic_type_value
!con_name = con_name.Text
!cer_type = cer_type_value
!post_type = post_type_value
!cer_no = cer_no.Text
!custom_addr = custom_addr.Text
!mailcode = mailcode.Text
!email = email.Text
!phone = phone.Text
!fax = fax.Text
!area1 = area1.Text
!area2 = area2.Text
!org_code = org_code.Text
!cal = cal_value
!bank = bank_value
!bank_no = bank_no.Text
!book_type = book_type.Text
!buss_reg = buss_reg.Text
!tux_no = tux_no.Text
!inv_type = inv_type_value
!oil_type = oil_type_value
!car_no = car_no.Text
!day_add = day_add.Text
!day_pay = day_pay.Text
!l_day = l_day.Text
!area_station = area_station.Text
!custom_no = custom_no.Text
!main_card_no = main_card_no.Text
!gil_no = gil_no.Text
!intro = intro.Text
!first_charge = first_charge.Text
!lg_f = lg_f.Text
!cw_f = cw_f.Text
!qg_f = qg_f.Text
!fjl_f = fjl_f.Text
!jl_f = jl_f.Text
.Update
End With
MsgBox ("添加成功")
dbrs.Close
db.Close
End Sub
用这段代码向数据库插入数据的时候,有的操作系统可以添加成功,但有的系统会提示80040e21
-2147217887错误,请问这是怎么回事?
说明:ic_type_value等变量都是用来储存OptionButton.caption的值的,但有可能为空,
数据库里的每一个字段都允许空字符,类型为文本
顺便问一下大家,在1024*768下设计的mdi窗体,如果用800*600的分辨率去打开的话,会有部分显示不了,可以在父窗体中用滚动条把子窗体显示完整吗?
db.open ...
db.execute "insert into tablename(...) values(...)"
if trim(lg_f.Text)<>"" then !lg_f = lg_f.Text
你可以这样试试,比如你字段lg_f可以有null
dim str '声明一个变体变量
str=null
rs!lg_f = str
rs.update
这样才可以