道歉多址表 - 我是一個新手到Visual Studio(和編程一般)如何從Visual Studio填充提前
我嘗試使用下面的代碼來填充兩個訪問表的業主和物業 - 但我一直收到
「在SQL語句末尾缺少分號(;)」。
有建議?代碼如下:
Dim aConnection As OleDbConnection
Dim aCommand As OleDbCommand
Dim aConnectionString, aQuery As String
Dim Username As String = txtUsername.Text
Dim Pword As String = TextBox2.Text
Dim EmailDetails As String = TextBox9.Text
Dim Question As String = DropDownList2.Text
Dim Answer As String = TextBox4.Text
aConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source = " _
& Server.MapPath("AppData/RMT.accdb")
aConnection = New OleDbConnection(aConnectionString)
aConnection.Open()
aQuery = "Insert Into Landlord (Username, email, Security_Question, Security_Answer, Pword, Status) Values ('" & Username & "','" & EmailDetails & "','" & Question & "','" & Answer & "', '" & Pword & "','pending')Into Property Values (26,46,'marysway','MarysRd','Marysville','Cork North')"
aCommand = New OleDbCommand(aQuery, aConnection)
aCommand.ExecuteNonQuery()
aConnection.Close()
'PWORD&「」,‘待定’)進入屬性值「 - 看起來很奇怪,但'我不是一個訪問專家。作爲一個常規提示:在你的OleDBCommand中使用OleDBParameters,它會使你的代碼更容易閱讀,並且更少出錯(嘗試插入日期;)) – igrimpe