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!

CFGRID

Status
Not open for further replies.

saurabh

Programmer
Jul 10, 2000
27
IN
i am inserting data in SQL table using CFGRID. But i have tried normal insert statements in the code and also through stored procedure..it does not show any error but does not insert the data also.......any help

 
The best advice I can give concerning CFGRID is... Don't use CFGRID!!

The problem with this tag is that it's a Java applet and, (as far as I'm concerned anyway) its incompatible with too many browsers.

You can make a simple html table pretty easily with a CFQUERY and CFOUTPUT that'll output in a grid format, then put an html form at the end for any inserts. Doing this will alleviate your CFGRID headaches...

A quick example...
[tt]
<!--- records.cfm --->

<CFPARAM NAME=&quot;action&quot; DEFAULT=&quot;&quot;>

<CFIF action EQ &quot;insert&quot;>
<CFQUERY DATASOURCE=&quot;mydb&quot; NAME=&quot;insertrecord&quot;>
INSERT INTO Employees (FirstName,LastName)
VALUES ('#FirstName#','#LastName#')
</CFIF>

<CFQUERY DATASOURCE=&quot;mydb&quot; NAME=&quot;TheRecords&quot;>
select ID,FirstName,LastName from Employees
order by LastName
</CFQUERY>

<HTML><HEAD><TITLE>Grid Example</TITLE></HEAD>
<BODY>

<TABLE>
<CFOUTPUT QUERY=&quot;TheRecords&quot;>
<TR>
<TD>#ID#</TD>
<TD>#FirstName#</TD>
<TD>#LastName#</TD>
</TR>
</CFOUTPUT>
</TABLE>

<FORM ACTION=&quot;records.cfm&quot; method=&quot;post&quot;>
<INPUT TYPE=&quot;hidden&quot; NAME=&quot;action&quot; VALUE=&quot;insert&quot;>
First Name: <INPUT TYPE=&quot;text&quot; NAME=&quot;FirstName&quot;><br>
Last Name: <INPUT TYPE=&quot;text&quot; NAME=&quot;LastName&quot;><br>
<INPUT TYPE=&quot;submit&quot; VALUE=&quot;SUBMIT&quot;>
</FORM>

</BODY>
</HTML>
[/tt]
You could put the output fields in form fields and put update and delete buttons in each row as well to allow more functionality.

Hope this helps,

DM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top