2个回答
2013-10-21
展开全部
Dim VarSource As String
VarSource = "insert into tb_basic(姓名,性别,出生日期,政治面貌编号,工作日期,入企日期,单位名称编号,职称级别编号,行政职务,行政职务就任时间,党内职务,党内职务就任时间,专业级别编号,学历编号,毕业院校,所学专业,备注) values('" & Trim(txt_name.Text) & "','" & Trim(cb_sex.Text) & "','" & Trim(txt_bir.Text) & "','" & Trim(str_plitics) & "','" & Trim(txt_work_date.Text) & "','" & Trim(txt_enter_date.Text) & "','" & Trim(str_unit) & "','" & Trim(str_post) & "','" & Trim(txt_post.Text) & "','" & Trim(txt_post_date.Text) & "','" & Trim(txt_party.Text) & "','" & Trim(txt_party_date.Text) & "','" & Trim(str_major) & "','" & Trim(str_study) & "','" & Trim(txt_school.Text) & "','" & Trim(txt_major.Text) & "','" & Trim(txt_other) & "')" If sql_execute(VarSource) = True Then
Else
MsgBox "没有保存!", , "提示窗口"
End If '公共函数Public Function sql_execute(strsql As String) As Boolean
Dim conn As New ADODB.Connection
Set conn = CreateObject("adodb.connection")
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\管理.mdb;Jet OLEDB:Database Password=123"
conn.Execute (strsql)
conn.Close
sql_execute = True
End Function
VarSource = "insert into tb_basic(姓名,性别,出生日期,政治面貌编号,工作日期,入企日期,单位名称编号,职称级别编号,行政职务,行政职务就任时间,党内职务,党内职务就任时间,专业级别编号,学历编号,毕业院校,所学专业,备注) values('" & Trim(txt_name.Text) & "','" & Trim(cb_sex.Text) & "','" & Trim(txt_bir.Text) & "','" & Trim(str_plitics) & "','" & Trim(txt_work_date.Text) & "','" & Trim(txt_enter_date.Text) & "','" & Trim(str_unit) & "','" & Trim(str_post) & "','" & Trim(txt_post.Text) & "','" & Trim(txt_post_date.Text) & "','" & Trim(txt_party.Text) & "','" & Trim(txt_party_date.Text) & "','" & Trim(str_major) & "','" & Trim(str_study) & "','" & Trim(txt_school.Text) & "','" & Trim(txt_major.Text) & "','" & Trim(txt_other) & "')" If sql_execute(VarSource) = True Then
Else
MsgBox "没有保存!", , "提示窗口"
End If '公共函数Public Function sql_execute(strsql As String) As Boolean
Dim conn As New ADODB.Connection
Set conn = CreateObject("adodb.connection")
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\管理.mdb;Jet OLEDB:Database Password=123"
conn.Execute (strsql)
conn.Close
sql_execute = True
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-10-21
展开全部
增加记录用的是insert语句,你这个被替换的问题,可能是用了update
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询