Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ado vfp database

Status
Not open for further replies.

nbob

Programmer
Aug 3, 2001
5
GB
I'm trying to update a fvp dbc from vb 6.0 using ado 2.6.
code like...

Code:
    ConnectionString = "Provider=vfpoledb.1;Data " _ 
        & "Source=..\star.dbc"

    Set objConnection = New adodb.Connection
    objConnection.Open (ConnectionString)

    cmd.ActiveConnection = m_objConnection
    cmd.CommandType = adCmdText

    cmd.CommandText = "UPDATE session SET " _
                    & "session.cl_date = ? " _
                    & "WHERE session.user = ?"

    cmd.Parameters.Append cmd.CreateParameter("@CloseDate", adDate, adParamInput, 8, Date)
    cmd.Parameters.Append cmd.CreateParameter("@UserID", adChar, adParamInput, 10, xUserID)

    cmd.Execute

.........
I get error ...
"Field CL_DATE does not accept null values."
.........

In session.dbf ... cl_date - type DATE, width 8

I've tried adDate, adDBDate, adDBTimestamp also tried ado in vfp7.0. and get the same error.

can anyone help?
thanks
 
Hi nbob,
You don't require to create parameters for update statement.
simply write your values in the commandtext like :
cmd.CommandText = "UPDATE session SET " _
& "session.cl_date = '"& myDate _
& "' WHERE session.user = '"&myUserid _
& "' "

be sure convert myDate to character type if it is date type variable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top