标题:[求助]!!!不能运行
只看楼主
kenny_910
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2005-11-30
 问题点数:0 回复次数:0 
[求助]!!!不能运行

代码一主要想实现添加新用户和密码,,运行的时候老是提示insert into语法错误???、/?,大家帮忙看一下错在哪里?代码二,确能运行

代码一
Try
Dim insertCmd, connStr As String
connStr = "provider=microsoft.jet.oledb.4.0;data source=D:\资料\study\VB.NET\学习\人事信息系统\person.mdb"

insertCmd = "insert into users(user_name,password) values('" & Trim(txtUserName.Text) & "','" & Trim(txtPassword.Text) & "')"
Dim conn As OleDbConnection
Dim cmd As OleDbCommand

conn = New OleDbConnection(connStr)
conn.Open()
cmd = New OleDbCommand(insertCmd, conn)
cmd.ExecuteNonQuery()

conn.Close()
Catch
MsgBox(Err.Description)

代码二
Try
Dim insertCmd, connStr As String
connStr = "provider=microsoft.jet.oledb.4.0;data source=D:\资料\study\VB.NET\学习\人事信息系统\person.mdb"

insertCmd = "insert into users(user_name) values('" & Trim(txtUserName.Text) & "')"
Dim conn As OleDbConnection
Dim cmd As OleDbCommand

conn = New OleDbConnection(connStr)
conn.Open()
cmd = New OleDbCommand(insertCmd, conn)
cmd.ExecuteNonQuery()

conn.Close()
Catch
MsgBox(Err.Description)

搜索更多相关主题的帖子: 运行 
2005-12-02 17:28



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-36363-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011304 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved