※ 引述《mermaid94 (一線之隔)》之銘言:
: 我寫了一個insert into的語法,想要在資料庫的資料表內新增一筆資料,
: 不知道為什麼 他一直說我的INSERT INTO的指令語法錯誤,
: 我看書上是這樣寫的,查了很多網路相關資源也看不太出所以然,
: 請各位高手幫我指點迷津好嗎?拜託了。
: Dim Connectstr As String = "Provider = Microsoft.Jet.OLEDB.4.0;
: Data Source =D:\DataBase\meal.Mdb;User ID =Admin;"
: '連結資料庫
: Dim MyConnection As New OleDbConnection(Connectstr)
: MyConnection.Open()
: (...中間略...我測過了沒錯)
: Dim InStr As String
: InStr = "INSERT INTO Uorder(ID,user,meal,price,count,total_price)"
: InStr = InStr & " VALUES('" & ONum & "','"
: InStr = InStr & Uname.Text & "','"
: InStr = InStr & Mname & "' ,'"
: InStr = InStr & Mprice & "','"
: InStr = InStr & "1','"
: InStr = InStr & Mprice & "')"
: Dim CMD As New OleDbCommand(InStr, MyConnection)
: Dim count As String = CMD.ExecuteNonQuery()
: MyConnection.Close()
--
-----------------------------------------------------------------------------
功課重,Project多的好幫手--專案王
http://steven.twbbs.org/ProjectKing
增加右鍵的威力RightMenuKing--右鍵王
http://steven.twbbs.org/RightMenuKing/
備份重要檔案的好幫BackupKing--備份王
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.192.165
你的欄位 全部都是文字嗎?
因為看你都有加 '闊起來
Price不是應該用數字就好了嗎