Syntax error with SaveChanges

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
KevClark64
Posts: 8
Joined: Thu 12 Dec 2013 22:30

Syntax error with SaveChanges

Post by KevClark64 » Thu 12 Dec 2013 22:36

I am trying to insert a new record, but when I execute SaveChanges, I get an error saying "Syntax error at or near "("". The data that I am submitting looks okay, and all the non-nullable fields are filled in (except for one sequence field that Postgres generates itself). I'd like to know either how to fix this error or see what the SQL is that is being submitted. Here is the code I am running:

Dim newacct As New OnlineEnrollment.onlineaccount
newacct.custnum = Me.custnum
newacct.emailaddress = Me.email(0).email
newacct.lastname = Me.lname
newacct.firstname = Me.fname
newacct.password = GenerateRandomString(8, True)
newacct.datecreated = Now
olEnr.onlineaccounts.AddObject(newacct)
olEnr.SaveChanges()

Any ideas on solving this problem?

Kevin Clark

KevClark64
Posts: 8
Joined: Thu 12 Dec 2013 22:30

Re: Syntax error with SaveChanges

Post by KevClark64 » Thu 12 Dec 2013 22:55

I was able to pull up the SQL that is being generated by SaveChanges. The problem seems to be that the tablename is not contained in the SQL. The SQL is something like:

Insert into () values ()

rather than

Insert into onlineaccount () values ()

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Syntax error with SaveChanges

Post by Shalex » Mon 16 Dec 2013 14:25

Please specify the exact version of your PostgreSQL server and send us a small test project to reproduce the problem in our environment.

KevClark64
Posts: 8
Joined: Thu 12 Dec 2013 22:30

Re: Syntax error with SaveChanges

Post by KevClark64 » Tue 17 Dec 2013 15:45

We were using an older version of dotConnect. When we upgraded to the latest version, the problem went away.

Kevin Clark
Seton Home Study School

Post Reply