vb Code:
Public Function CreateDatabase(ByVal DBDirectory As String) As Boolean With frmNewEditCourse Dim DB As New ADOX.Catalog() Try DB.Create(Connection.ConnectionString) SQL = "CREATE TABLE [Information] ([CIndex] AutoIncrement, [CourseCode] TEXT, [RoomNumber] TEXT, [SchoolYear] TEXT, [Teacher] Text)" Command = New OleDbCommand(SQL, Connection) Command.Connection.Open() Command.ExecuteNonQuery() Command.CommandText = "INSERT INTO [Information] (CourseCode, RoomNumber, SchoolYear, Teacher) VALUES(@CourseCode, @RoomNumber, @SchoolYear, @Teacher)" Command.Parameters.AddWithValue("@CourseCode", .txtCourseCode.Text) Command.Parameters.AddWithValue("@RoomNumber", .txtRoomNumber.Text) Command.Parameters.AddWithValue("@SchoolYear", .txtSchoolYear.Text) Command.Parameters.AddWithValue("@Teacher", .txtTeacher.Text) Command.Connection.Close() MsgBox("Done") Catch Excep As System.Runtime.InteropServices.COMException Finally DB = Nothing End Try End With End Function
Theirs my Function, what it does is it creates a Database and then its suppose to write the values into the database. Its creating it, but its just not inserting the values into the Table. Why?
Edit:
No Errors Occur and the MsgBox does show up.




Reply With Quote