Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting to an Access database
Message
From
13/11/2001 17:20:55
 
 
To
13/11/2001 17:09:44
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00581101
Message ID:
00581184
Views:
18
You could query the table for the values you just inserted (see also sample on closing the connection)
cSQL = "Select course,name,[date] From Training Where ";
        + "course = '" + lcCourse + "' ";
        + "And name = '" + lcEmployeeName + "' " ;
        + "And [date] = '" + ldDate + "'"
oRS = oCn.Execute(cSQL)
If oRS.EOF And oRS.BOF Then
  *-- insert failed.
Endif
*-- Close Connection
oCn.Close
Note that this assumes that the course+name+date combination is unique in the table. If it is not, then this code will not accurately tell you if the insert was succesful. HTH

>Crescencio,
>
>How can I check that my insert succesfully executed.
>
>Here is the code for my insert:
>
>********************************************************************
>cSQL = "INSERT INTO Training ( course, name , [date] ) ;
> Values ( " + "'" + lcCourse + "' , ;
> " + "'" + lcEmployeeName + "' , ;
> " + "'" + ldDate + "' )"
>oCn.Execute(cSQL)
>*******************************************************************
>
>
>Also do you know how to close the connection.
>
>Here is how I created the connection :
>
>***********************************************************
>lcMDBStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=l:\ehs\data\eh&s.mdb;"
>oCn = Create("adodb.Connection")
>oCn.Open(lcMDBStr)
>
>*********************************************************
>
>Thanks in advance,
>Sergio
Previous
Reply
Map
View

Click here to load this message in the networking platform