vb.net 向access数据库表添加记录
vb.net怎么向access数据库表添加记录啊,谢谢,给我说一下,用代码哈 --------------------编程问答-------------------- 和SQL SERVER同樣處理啊用OLEDB連接就可以了。 --------------------编程问答-------------------- 是,不知道为什么,加不进去啊,所我想让你帮我一下,写一下代码给我看一下,我错在哪里 --------------------编程问答-------------------- try
dim strconn as string="Data Source='../Tele.mdb';Provider='Microsoft.Jet.OLEDB.4.0';User ID=Admin;"
dim strinsert as string="insert into(name,tele) values('自己','11111')"
dim cmdconn as oledb.oledbconnection(strconn)
dim cmddc as oledb.oledbcommand(strinsert,cmdconn)
dim i as integer
i=cmddc.ExecuteNonQuery ()
msgbox("添加成功!以添加"& i &"项")
Catch ex As Exception
MsgBox(ex.Message)
End Try
这样回答可以吗? --------------------编程问答-------------------- try
dim strconn as string="Data Source='../Tele.mdb';Provider='Microsoft.Jet.OLEDB.4.0';User ID=Admin;"
dim strinsert as string="insert into tablename(name,tele) values('自己','11111')"
dim cmdconn as oledb.oledbconnection(strconn)
dim cmddc as oledb.oledbcommand(strinsert,cmdconn)
dim i as integer
cmdconn.open()
i=cmddc.ExecuteNonQuery ()
msgbox("添加成功!以添加"& i &"项")
cmdconn.close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
这样就能添加了 --------------------编程问答-------------------- 你的代码帖出来看看!
补充:.NET技术 , VB.NET