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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting error: Incorrect syntax near the keyword 'DEFAULT' 1

Status
Not open for further replies.

purplehaze1

Programmer
Jul 23, 2003
86
US
I am trying to update a record in customer table located in sybase database.
I use commandbuilder. I get following error msg. How can I fix it?
It works in SQL Server. Thanx.

ERROR [HY00] [INTERSOLV][ODBC SQL Server driver][SQL Server]
Incorrect syntax near the keyword 'DEFAULT'.

commandText built by commandbuilder.
INSERT INTO t_customer DEFAULT VALUES

.....

Public Function SaveCustomer() As Boolean
Dim strsql As String
Dim myCommand As OdbcCommand
Dim dr As DataRow, i As Integer

Try

strsql = "SELECT * FROM t_customer WHERE cust_id=" & m_custID
myCommand = New OdbcCommand(strsql, myConnection)
Dim da As New OdbcDataAdapter(myCommand)
Dim cb As New OdbcCommandBuilder(da)
Dim ds As New DataSet()

da.Fill(ds, "Customer")

If ds.Tables(0).Rows.Count = 0 Then
dr = ds.Tables(0).NewRow()
IsNew = True
GoTo SaveRecord
Else
dr = ds.Tables(0).Rows(0)
End If

SaveRecord:
dr("cust_cde") = m_custCode
dr("cust_name") = IIf(m_custName = String.Empty, Nothing, m_custName)

''Delegate for Handling RowUpdated event
AddHandler da.RowUpdated, AddressOf HandleRowUpdated
da.Update(ds, "Customer")

End Function


Private Sub HandleRowUpdated(ByVal sender As Object, ByVal e As OdbcRowUpdatedEventArgs)
...
...
...
end sub
 
I searched for:
"Incorrect syntax near the keyword 'DEFAULT'"
in google and I got many results like:

(look at the bottom of the page)

And:

(A constraint without a name?)

And:
 
I searched for:
"Incorrect syntax near the keyword 'DEFAULT'"
in google and I got many results like:

(look at the bottom of the page)

And:

(A constraint without a name?)

And:
 
I searched for:
"Incorrect syntax near the keyword 'DEFAULT'"
in google and I got many results like:

(look at the bottom of the page)

And:

(A constraint without a name?)

And:
 
Since above commandbuilder update (insert/delete/update) won't work in my Sybase db, how can u write your own update logic? Thanx.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top