Date in Power Builder 7 and Access

I have a database in Microsoft Access 97. The definition field is DateTime  and in the Script Boton, define a DateTime variable type and write a Sql Statement (Insert), puting the follow statement :

************************ Event Click
DateTime  ldtm_hoy

ldtm_hoy = DateTime ( Today (), Now() )

INSERT INTO cuenta_corriente
            ( fecha_inicio )
     VALUES ( :ldtm_hoy ) ;

***************

And when saved my form the error occur "C0038:SqlState = 3700 [ODBC Microsoft Access Driver ] Reserved error(|); there is no message for this error."

I don't know, what is this, what i do ? plese respond me
I'm sorry, my inglish is very poor.  my mail is fstuven@infoauto.gov.ar
pepeAsked:
Who is Participating?
 
BhattiConnect With a Mentor Commented:
If ODBC connection and the formats of the datetime in your table and variable you are inserting are same, then please try this.

Sometimes you need to add the name of the table with the name of the column in the INSERT statement.

INSERT INTO cuenta_corriente
                                ( cuenta_corriente.fecha_inicio )
                         VALUES ( :ldtm_hoy ) ;

May this will help you.
0
 
kokanCommented:
Intead of using a datatime field, you can use a string value to store the date time value and insert into the table.  It should work.
0
 
BhattiCommented:
Check your ODBC connection to Access. If it is OK then

Please check the format of the datetime in your table and the format of the datetime you are inserting.

Let me know please for further actions if necessary.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
pepeAuthor Commented:
I take the kokan@devx propos becouse i'm check the ODBC and check the format and insert format in the table too.

If somebody know other way, please let me know.

THANK.

0
 
darrelljudeCommented:
//See whether the below code will work by creating
//datastore and let the powerbuilder handle the insert
//instead of a straight insert SQL - darrell

string ls_select,ls_err
long ll_row
DateTime  ldtm_hoy
datastore  ds_cuenta_corriente

ls_select = 'select fecha_inicio from cuenta_corriente'

ds_cuenta_corriente = create datastore

ds_cuenta_corriente.create(syntaxfromsql(sqlca, ls_select,' ', ls_err), ls_err)

ds_cuenta_corriente.settransobject(sqlca)
ll_row = ds_cuenta_corriente.insertrow(0)


ldtm_hoy = DateTime ( Today (), Now() )

ds_cuenta_corriente.setitem(ll_row,'fecha_inicio',ldtm_hoy)

ds_cuenta_corriente.update()
commit;

destroy ds_cuenta_corriente
0
 
ksalmanCommented:
I created a table test1 with two columns (field1 datetime, field2 long) in Access.

Then I wrote the following code in powerbuilder
and it inserted records into the table properly.

DateTime  ldtm_hoy

ldtm_hoy = DateTime ( Today (), Now() )

INSERT INTO test1 ( "field1", "field2" )
    VALUES ( :ldtm_hoy, 1 ) ;

      IF SQLCA.SQLCODE <> 0 THEN
          MessageBox("Error", SQLCA.SQLErrText)
      END IF
commit;


Are you specifying all the columns required for the insert statement?

You need to specify all the required columns in that table
in your insert statement.
0
 
SpideyModCommented:
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.