Hi I've searched all over the internet for this but can't find anything useful. I have form which a user fills out and then inserts in access database. But I also have a field DateTime in my table which I want to automatically save the current date and time in the database. How do I do this? Thank you. I keep getting an error saying "an oledbparameter with parameter name '@datetime' is not contained by this oledb"


            With cmd
                .Connection = con
                .CommandType = CommandType.Text
                .CommandText = "INSERT INTO tJ (S, T, DateTime) VALUES (@S, @T, @DateTime)"

                .Parameters.Add(New System.Data.OleDb.OleDbParameter("@S", System.Data.OleDb.OleDbType.VarChar, 255, Me.cmbN.Text))
                .Parameters.Add(New System.Data.OleDb.OleDbParameter("@T", System.Data.OleDb.OleDbType.VarChar, 255, Me.cmbT.Text))
                .Parameters.Add(New System.Data.OleDb.OleDbParameter("DateTime", System.Data.OleDb.OleDbType.Date))

                cmd.Parameters("@S").Value = Me.cmbN.Text
                cmd.Parameters("@T").Value = Me.cmbT.Text
                cmd.Parameters("@DateTime").Value = Date.Now

                MsgBox("saved.", MsgBoxStyle.Information)

New System.Data.OleDb.OleDbParameter("DateTime",

This is the cause for your exception. Write Parameters properly.
You can use the datatype as OleDb.OleDbType.DBTimeStamp.
And also you can declare the parameters more consizely. Like

.Parameters.Add("@S", System.Data.OleDb.OleDbType.VarChar, 255).Value = Me.cmbN.Text
.Parameters.Add("@T", System.Data.OleDb.OleDbType.VarChar, 255).Value = Me.cmbT.Text
.Parameters.Add("@DateTime", System.Data.OleDb.OleDbType.DBTimeStamp).Value = Date.Now()