General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Inserting records to an Access database
Hello everyone,
I am inserting recods to an access database and I need to check if the records have been inserted succesfully. Can anyone tell me how to do that.?
Here is the code : The code is located in the Click event of a command button within a form.
*-- Insert a record to a VFP table
lcNewID = newid("training")
INSERT INTO training (training_id , name , date ) ;
VALUES ( lcNewID, CourseList.name, Thisform.txtTrainingDate.Value)
*-- Inset a record to an acces table
lcCourse = CourseList.Name && get the name from a VFP table called CourseList
lcMDBStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=l:\ehs\data\eh&s.mdb;"
oCn = Create("adodb.Connection")
oCn.Open(lcMDBStr)
oCn.Execute("INSERT INTO Training ( name );
Values ( " + "'" + lcCourse + "' ) ")
Thisform.Reset()
*******************************************************************************
Thanks,
Sergio
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only