Hi
I cannot seem to get this to work, I've checked through and as far as I can tell I've done everything I should have. I'm using Win XP Pro with NTFS by the way..
The permissions have been set on the folder that contains the databases so that the ASPNET user account can have full control and confirmed that the change permission is set..
The table is just a simple user table with basic fields. The ID and Username fields are both unique but the ID field is an autonumber.
All I am doing is trying to create a new user account and I get "Syntax error in INSERT INTO statement". I've checked the Insertable command and this is what it is:
INSERT INTO secUsers( UserName , GroupID , Password , DisplayName , FirstName , Surname , Email , Website ) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? )
Here's a bit of the code:
Dim Connect As OleDbConnection = New OleDbConnection()
Dim Adapter As OleDbDataAdapter = New OleDbDataAdapter()
Dim UserCB As OleDbCommandBuilder
Dim UserDS As DataSet = New DataSet()
Dim strSelect As String
Dim Row As DataRow
Const conTable As String = "Users"
Private Sub btnApply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnApply.Click
If Me.txtPassword.Text = Me.txtPassword2.Text Then
GetUser(0)
Row = UserDS.Tables(conTable).NewRow
Row.BeginEdit()
Row.Item("GroupID") = 0
Row.Item("UserName") = Me.txtUserName.Text
Row.Item("Password") = Me.txtPassword.Text
Row.Item("DisplayName") = Me.txtDisplayName.Text
Row.Item("FirstName") = Me.txtFirstName.Text
Row.Item("Surname") = Me.txtSurname.Text
Row.Item("Email") = Me.txtEmail.Text
Row.Item("Website") = Me.txtWebsite.Text
UserDS.Tables(conTable).Rows.Add(Row)
Adapter.Update(UserDS, conTable)
If UserDS.HasErrors Then
Info.Text = "Error: " & UserDS.Tables(conTable).Rows(0).RowError
Else
Info.Text = "Nice one!"
End If
'Info.Text = UserCB.GetInsertCommand.CommandText
Server.MapPath(Nothing)
End If
End Sub
Private Sub GetUser(ByVal UserID As Integer)
strSelect = "SELECT * FROM secUsers WHERE ID=" & UserID
Connect.ConnectionString = ConnectionStr
Adapter.SelectCommand = New OleDbCommand(strSelect, Connect)
UserCB = New OleDbCommandBuilder(Adapter)
UserCB.GetInsertCommand()
Adapter.Fill(UserDS, conTable)
End Sub
Is there anything wrong with the code? The connection string is very basic, I'm using Jet 4.0 with Share Mode Deny None.
I can read from the database, so the connection is otherwise OK.
Please, please, please can you help as this has gone beyond a joke and I'm loosing hair..
Thanks!