Skip to main content
Participating Frequently
January 20, 2008
Question

cfinsert works with mySQl 5 but NOT with ms sql server 2005

  • January 20, 2008
  • 2 replies
  • 353 views
First i would consider myself an "advanced" beginner at coldfusion.

I had a setup of coldfusion 8 with mySQL5 w/GUI interface. I do my development in eclipse.

I wrote a VERY simple code, with a simple database table, and it submitted the data fine no problems. (i verified the data and it was indeed submitted)

<cfif IsDefined ("form.posted")>
<cfinsert datasource="cfsales" tablename="test"
formfields = "fred, jones,">
</cfif>


<cfform format="flash" preloader="false">
<cfinput name="fred" label="fred" type="text" width="100">
<cfinput name="jones" label="jones" type="text" width="100">
<cfinput name="submit" value="submit" type="submit">
</cfform>
<cfdump var="#form#">

NOW im being FORCED to use MS SQL Server. so i wiped out everything (mySQl, All projects deleted from eclipse, All databases re-added properly in coldfusion administrator)

now i CAN get data from the MS SQL database but i can not place anything into it.

NOTE: i re-created tables and columns and database names are EXACTLY the same as with mySQL. i re-wrote my code correctly too.(i think) SAME CODE AS ABOVE.

datasource=cfsales table=test columns=fred, jones

cfdump shows data collected from form correctly.

Is there additional code to place for MS SQL server that i dont know of?

thanks in advance.
What the heck could be wrong?

UPDATE

I seem to be able to enter data into MS SQL server if i dont have the cfform format as flash for some odd reason. Very odd since mySQL 5 didnt complain at all.

Any ideas would still be appreciated.



This topic has been closed for replies.

2 replies

Inspiring
January 21, 2008
What is the error message?

Jochem

--
Jochem van Dieten
Adobe Community Expert for ColdFusion
Participating Frequently
January 21, 2008
I never use cfinsert/cfupdate because they have been nothing but a buggy mess since I've been involved with ColdFusion, but your problem may be related to CF not being able to determine what your primary key fields are, etc. When you converted from MySQL to MSSQL, how did you handle the PK fields? Are they defined as such? Were they created with the IDENTITY property, etc.?

I have always used cfquery tags and SQL UPDATE and INSERT statements because they offer much more control, and cfinsert/cfupdate just plain suck, so I don't have a lot of advice to offer.

Sorry,
Phil