Linking database query to datagrid?
Hi,
I am trying to to do a query from database and display the
result to the datagrid. I've heard people is doing it but how does
it work? Any reference?
i use java servlets.. the most challenging thing to me when
starting down this route was figuring out how to dynamically
configure the grid based on the data. almost every example i came
across required you to know the columns before receiving the data.
to create your own columns, you do something like:
var columNames:Array = [ "id", "name", "address" ];
var gridCols:Array = [];
var totalWidth:int = myGrid.width;
for each( var n:String in columnNames )
var column = new DataGridColumn();
column.dataField = n;
column.width = totalWidth / columnNames.length;
// set other properties like width, headerText, itemRenderer
etc
gridCols.push( column );
// set the grid columns which forces the redraw
myGrid.columns = gridCols;
./paul
Similar Messages
-
Another Error Executing Database Query.
I am getting this error.
12:40:54.054 - Database Exception - in
C:\CFusionMX7\wwwroot\Author\dropdown2\EmployeeAddAction.cfm : line
26
Error Executing Database Query.
i have added extra fields in the mdb and added extra code to
the form page and the action page.
i am getting this error still.
this is how i broke it down.
If I run my 2 files EmployeeAddForm.cfm and
EmployeeAddAction.cfm
I get this error:
NOTE: if i take out the comments from the code and ignore the
new fields added to the db it works fine!!!!!
The web site you are accessing has experienced an unexpected
error.
Please contact the website administrator.
The following information is meant for the website developer
for debugging purposes.
Error Occurred While Processing Request
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
INSERT INTO statement.
Resources:
Enable Robust Exception Information to provide greater detail
about the source of errors. In the Administrator, click Debugging
& Logging > Debugging Settings, and select the Robust
Exception Information option.
Check the ColdFusion documentation to verify that you are
using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Remote Address 127.0.0.1
Referrer
http://127.0.0.1:8500/Author/dropdown2/EmployeeAddForm.cfm
Date/Time 06-Jun-07 12:40 PM
NOTE: if i take out the comments from the code and ignore the
new fields added to the db it works fine!!!!!Try using '###CreateODBCDate(Form.DateOfBirth)###'. Access is
strange on
handling dates. It has a been a while since I have used
Access so it could
be as simple as wrapping it single quotes as well. I am
assuming the
"<!-----------" wasn't intended, but I could be wrong.
Bryan Ashcraft (remove brain to reply)
Web Application Developer
Wright Medical Technology, Inc.
Macromedia Certified Dreamweaver Developer
Adobe Community Expert (DW) ::
http://www.adobe.com/communities/experts/
"Coldfusionstudent" <[email protected]>
wrote in message
news:[email protected]...
>I am getting this error.
> 12:40:54.054 - Database Exception - in
>
C:\CFusionMX7\wwwroot\Author\dropdown2\EmployeeAddAction.cfm : line
26
> Error Executing Database Query.
>
> i have added extra fields in the mdb and added extra
code to the form page
> and
> the action page.
> i am getting this error still.
> this is how i broke it down.
>
> If I run my 2 files EmployeeAddForm.cfm and
EmployeeAddAction.cfm
> I get this error:
>
> The web site you are accessing has experienced an
unexpected error.
> Please contact the website administrator.
>
> The following information is meant for the website
developer for debugging
> purposes.
>
> Error Occurred While Processing Request
> Error Executing Database Query.
> [Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft
> Access Driver] Syntax error in INSERT INTO statement.
>
>
> Resources:
> Enable Robust Exception Information to provide greater
detail about the
> source
> of errors. In the Administrator, click Debugging &
Logging > Debugging
> Settings, and select the Robust Exception Information
option.
> Check the ColdFusion documentation to verify that you
are using the
> correct
> syntax.
> Search the Knowledge Base to find a solution to your
problem.
>
>
> Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
5.1; SV1; .NET CLR
> 1.1.4322; .NET CLR 2.0.50727)
> Remote Address 127.0.0.1
> Referrer
http://127.0.0.1:8500/Author/dropdown2/EmployeeAddForm.cfm
> Date/Time 06-Jun-07 12:40 PM
>
>
>
> EmployeeAddForm.cfm
>
> <cfquery name="GetCompanies"
> datasource="#Request.MainDSN#">
> SELECT
> CompanyID,
> CompanyName
> FROM
> Company
> ORDER BY
> CompanyName
> </cfquery>
>
> <html>
> <head>
> <title>ColdFusion MX Bible</title>
> <link rel="stylesheet" href="styles.css">
> </head>
>
> <body>
>
> <h1> </h1>
>
> <table>
> <cfform action="EmployeeAddAction.cfm"
method="POST">
>
> <tr>
> <td>Company</td>
> <td>
> <cfselect name="CompanyID"
> size="1"
> query="GetCompanies"
> value="CompanyID"
> display="CompanyName"
> required="Yes"
> message="Please select a Company."></cfselect>
> </td>
> </tr>
>
> <tr>
> <td>SSN</td>
> <td>
> <cfinput type="Text"
> name="SSN"
> message="Please enter the employee's Social Security
Number."
> validate="social_security_number"
> required="Yes"
> size="12"
> maxlength="11">
> </td>
> </tr>
>
> <tr>
> <td>First Name</td>
> <td>
> <cfinput type="Text"
> name="Firstname"
> message="Please enter the employee's first name."
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr>
>
> <tr>
> <td>Last Name</td>
> <td>
> <cfinput type="Text"
> name="Lastname"
> message="Please enter the employee's last name."
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr>
>
> <tr>
> <td>Salary</td>
> <td>
> <cfinput type="Text"
> name="Salary"
> message="Please enter a valid salary."
> validate="float"
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr>
>
> <tr>
> <td>DOB</td>
> <td>
> <cfinput type="Text"
> name="DateOfBirth"
> message="Please enter a valid date of birth in the
format mm/dd/yyyy"
> validate="date"
> required="Yes"
> size="11"
> maxlength="10">
> </td>
> </tr><!-------------
> <tr>
> <td>device_typ</td>
> <td>
> <cfinput type="Text"
> name="device_typ"
> message="Please enter the employee's device_typ."
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr><tr>
> <td>device_Email</td>
> <td>
> <cfinput type="Text"
> name="device_Email"
> message="Please enter the employee's device_Email."
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr><tr>
> <td>Work_email</td>
> <td>
> <cfinput type="Text"
> name="Work_email"
> message="Please enter the employee's Work_email."
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr><tr>
> <td>Pin_Number</td>
> <td>
> <cfinput type="Text"
> name="Pin_Number"
> message="Please enter the employee's Pin_Number."
> required="Yes"
> size="22"
> maxlength="20">
> </td>
> </tr>------------------>
> <tr>
> <td> </td>
> <td>
> <input type="submit" value="Add to Database">
> </td>
> </tr>
>
> </cfform>
> </table>
>
> </body>
> </html>
> ---------------------------
> EmployeeAddAction.cfm
>
> <cfquery name="InsertEmployee"
> datasource="#Request.MainDSN#">
> INSERT INTO Employee(
> SSN,
> CompanyID,
> Firstname,
> Lastname,
> Salary,
> DateOfBirth<!----------,
> device_typ,
> device_Email,
> Work_email,
> Pin_Number-------------->
>
> )
> VALUES (
> '#Trim(Form.SSN)#',
> #Val(Form.CompanyID)#,
> '#Trim(Form.Firstname)#',
> '#Trim(Form.Lastname)#',
> #Val(Form.Salary)#,
> #CreateODBCDate(Form.DateOfBirth)#<!-----------,
> '#Trim(Form.device_typ)#',
> '#Trim(Form.device_Email)#',
> '#Trim(Form.Work_email)#',
> '#Trim(Form.Pin_Number)#'------------------>
> )
> </cfquery>
>
> <cfmail
to="#Form.Firstname#.#Form.Lastname#@somewhere.com"
> from="[email protected]"
> subject="Welcome to your new company!">
> Welcome to your new company, #Form.Firstname#
#Form.Lastname#!
> </cfmail>
> <!----
> <cflocation url="EmployeeList.cfm">----->
> -
Generate an xml file from Database query results
Hi, can anyone help me out with this problem I'm having. What are the steps in creating an xml file directly from the results of a database query. I currently have a very simply process that queries a database via a partner link. The query returns the data but it's from this point that I am stuck. I need to create an xml file with the data along with the xml tags. I've looked at dozens of tutorials with no luck.
I would greatly appreciate help with this.
bpel rookieShould be quite simple.
Create another partnerlink, configure it to use the file adapter, and write to an XML file. In this case you need to create an XML Schema (.xsd) of the file you want to create.
Before you write to the file, either add assign steps to copy individual attributes or use a transform activity to convert from the database format to the file (xml) format. -
How to extract the Physical Query(database Query)
Hi ,
How to extract the Physical Query(database Query) from obiee which was fired in obiee
Regards
RangaHi Ranganath,
Have a look the following links.
Setting Logging level:
http://gerardnico.com/wiki/dat/obiee/loglevel
How to see physical query:
http://gerardnico.com/wiki/dat/obiee/manage_session_log
If you are new to OBIEE, spend some hours on the following blog to learn from basics to advanced level.
http://gerardnico.com/wiki/
http://obiee101.blogspot.com/
http://www.rittmanmead.com/blog/
Hope it helps you.
Regards,
Kalyan Chukkapalli
http://123obi.com -
Listing mysql database tables in DataGrid
Hi everyone,
I'm trying to Display all availible Tables of a Database in a DataGrid.
Rather than listing the data in the column, it lists them in the first row of the column sperated by comma.
Please, can someone tell me what i'm doing wrong there?
Thanks in Advance.
Mat
Code so far:
<mx:DataGrid id="dgTableListRequest" x="75" y="60" dataProvider="{tableListRequest.lastResult.tablelist}" height="145">
<mx:columns>
<mx:DataGridColumn headerText="Tables" dataField="table"/>
</mx:columns>
</mx:DataGrid>
PHP:
$Query = "SHOW TABLES FROM vokabeln";
$Result = mysql_query( $Query );
$Return="<tablelist>";
while ($row = mysql_fetch_row($Result)) {
$Return.="<table>".$row[0]."</table>";
$Return.="</tablelist>";
print ($Return);This should work:
<mx:DataGrid id="dgTableListRequest" x="75" y="60" dataProvider="{tableListRequest.lastResult.tablelist.table}" height="145">
<mx:columns>
<mx:DataGridColumn headerText="Tables" dataField="*"/>
</mx:columns>
</mx:DataGrid> -
Database link create but not fatch data from link database give me this err
Sir I create database link with this command system create link
but when I user query then system give me this error you see in blow
SQL> create database link xyz connect to mfatest identified by mfa786 using 'aamir';
Database link created.
SQL> select * from accbal@xyz;
select * from accbal@xyz
ERROR at line 1:
ORA-28546: connection initialization failed, probable Net8 admin error
ORA-02068: following severe error from XYZ
ORA-03113: end-of-file on communication channel
this is same database but diffrent user
scott user
mfatest user
please give me idea how i fatch data from link database/link other user
thank
aamirOn the machine where you get that error does this work ?
SQL> connect mfatest/mfa786@aamir
SQL> select count(*) from accbal;
If it doesn't, please post tnsnames.ora and sqlnet.ora from local machine, and the result, on remote machine, of
C:\> lsnrctl services -
Using the Service Link Database adapter
I had a question regarding the use of the Service Link database adapter. We've configured an adapter that will write rows to a certain table in an oracle database. The rows are written into the table correctly. I've also configure the inbound portion of the database adapter to retrieve records but there are 2 problems.
1. When creating the SQL that is used to poll the database table, I'm not able to use the channel id namespace. According to the manuals and training materials that I have reviewed, it looks like you should be able to call #channelid# in your query and the system should automatically translate that. I've tried #channelid#, #channel-id#, and #ChannelID# but if doesn't seem to covert the value to the actual channel ID. Can you use namespaces in the polling query?
2. If I setup the queries without namespaces, I can get into the next step where it excutes the sucessful or failed sql query. I setup a simple transformation that automatically closes the assocaited task when the query is run. I then setup a SQL statement to delete all rows in the table (I only did this because I could not target a row without the channelid namepsace working). The problem is that when I submit a task that uses the agent, the agent polls the database and finds the task. The agent then closes the asscaited task, per my transformation, but when it goes to delete all rows in the table, the rows are not removed. If I execute the same SQL using the same account in a SQLPlus window, the rows are deleted so I think that my SQL is good. I'm not sure why it does not work and the only message in the log is:
2010-07-08 15:52:23,677 DEBUG [com.newscale.is.adapter.db] [ AgentId-5 ] Fetched 1 new records
2010-07-08 15:52:23,804 ERROR [com.newscale.is.adapter.db] Outbound Message Failed to deliever
This is my SQL: delete from rcowner.rcapprovals where STATUS_code='Registered'
Any help or advice is apprecaited.
TimHi Tim -
The namespace that you can use comes from the SELECT SQL statement. So you need to write out the Channel ID into a field in the db table (you need it around anyway for the transformation). Then the inbound SQL needs to include the channel ID field in the select statement. Then the success/failure SQL statements can reference the channel ID field from the inbound SQL.
Inbound example: SELECT CHANNEL_ID FROM MYTABLE WHERE STATUS = 2
success example: UPDATE MYTABLE SET STATUS=3 WHERE CHANNEL_ID=#channel_id#
(Note that it seems to convert field names to all lower case. And the #channel_id# is just referencing the field from the other query -- it isn't a namespace or anything.)
Your delete statement probably isn't working because the db connection is still using the records from the inbound query. Its looping through each record from the inbound query and performing the transformation, then running the success/failrue sql before going onto the next record. -
I have made a database query:
try{
java.lang.Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:abc@abc","login","pwd");
HashMap params=new HashMap();
q=new Query("CORE_SYSTEM/TRN_SHORD_DESC",true);
dbr=q.executeQuery(params,con);
taQueryOut.setText(""+q);
taQueryOut.append(""+dbr);
}catch(Exception e){
e.printStackTrace();
} // end try-catch
The code is not important, it works.
What methods are there for me to use for printing out the number of results returned etc. A link to a reference material would be handy too. Note that the database used is Oracle, so if there are any ora-specific functions available, good.This is the technique that I use to count rows:
Quick trick that I use is
1. make sure that your Statement is type_scroll_insensitive:
connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);2. move your cursor to the last row(after executing your query)
resultset.last();3. get the row number:
int numberOfRows = resultset.getRow(); /*returns the number of rows*/4. set the cursor back to the beginning:
resultset.beforeFirst();5. ready to process the rows as usual.
This technique has a drawback though:
a scrollable resultset has less performance than non-scrollable
hope this might help,
Jamie -
Complex database display for Datagrid
Hi to all,
I am new to Flex (& Web GUI design).
I am trying (unsuccessfully) to develop a display that
monitors the condition of items at different locations in the form
of a datagrid.
The database system provided to me basically use a
"many-to-many" relationship to store the data:
1. Table Item: item_id
2. Table Appl: appl_id, location_name
3. Item-Appl Mapping Table: maps item_id to appl_id
Basically, 1 item is being monitored by several Appl at
different locations; while 1 Appl can also monitor multiple Items.
In my design, I have to continously query the database to
obtain the current condition of the Item, where I try to obtain the
following information:
Notification table: item_id, Appl_id, Time, Type
; where Type indicates the change in the Item (item_id)
condition at location (Appl_id).
Based on this query, i need to update the item status on the
Datagrid
The main issue here is:
1. How do I design the dataProvider for the dataGrid (Item vs
Location)
- I have to dynamically create the dataGrid Column since the
location can be dynamically changed/added/removed from the
database.
My dataGrid should look like this :
Item "A" "B" "C"
M X O O
N O O X
R O O O
"A","B", "C" are Location names; which are user-inputs &
I do not have any information about it beforehand. I have to obtain
this locations from the location_name in Appl Table.
The X,O indicates the condition of the Item.
Has anyone done something similar to this before & point
me to the right direction?
Many thanks,
Regards,
hyHi,
Very much thanks for the reply.
In my case, more than 1 Appl can monitor 1 item at same
location (which can be a big hierarchy of places:
A->AA->AAA).
E.g.: Appl #1 monitor Item M at Location A.AA & Appl #2
monitor Item M at Location A.AB. I need to display the overall
result for Location A (Location A.AA and A.AB)
This means that I need to store the result 1st somewhere in
my cache & then do some post-query processing to obtain my
final result.
What would be the best arrangement to store this data &
how can I set it as my dataProvider to the dataGrid?
Thank you very much.
Regards,
hy -
Error Executing Database Query. (Please help)
I can't get this query to work properly. I have gone over it so many times.. I can't count, I don't get why it's throwing an error. Here is my code, and followed by the error:
My update query:
<cfquery name="UpdateDetails" datasource="#APPLICATION.dataSource#">
UPDATE books234
SET
books234.title=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.title#">,
books234.info=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.info#">,
books234.statement=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.statement#">,
<cfif fileuploaded is true>
books234.MYFile=<cfqueryparam cfsqltype="cf_sql_varchar" value="#uploadedfile#">,
</cfif>
books234.links=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.links#">,
books234.ordNum=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.ordNum#">
WHERE books234.ID = <cfqueryparam value="#form.ID#" cfsqlType="CF_SQL_INTEGER">
</cfquery>
<cflocation url="bookView.cfm?ID=#Form.ID#" addtoken="no">
Here is my error:
Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver]Invalid precision value
The error occurred in C:\websites\209689jh6\slideAction.cfm: line 455
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm: line 442
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm: line 390
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm: line 1
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm: line 455
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm: line 442
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm: line 390
Called from C:\websites\209689jh6\admin\cms\slideAction.cfm: line 1
453 : books234.links=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.links#">,
454 : books234.ordNum=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.ordNum#">
455 : WHERE books234.ID = <cfqueryparam value="#form.ID#" cfsqlType="CF_SQL_INTEGER">
456 : </cfquery>
457 : <cflocation url="bookView.cfm?ID=#Form.ID#" addtoken="no">
Can anyone see what I did wrong here? It's not like it's a sophisticated query. I write these all the time.
Thank you.Does it work without using cfqueryparam in the WHERE statement? Are you sure the type CF_SQL_INTEGER is correct? Is the value of form.ID really an integer?
Cheers -
Java code vs database query performance ?????
Hi to all forum Members,
I am quite new in this forum, if i am at wrong place to post the query, please direct me to right place.
Question background : I want to have date in dd.MM.yyyy format in my excel sheets. Therefore, i have two possibilities
1- either to parse date from timestamp ( loaded column values from database ) in java
2 - or write a query in such a way which cast timestamp as date e.g.
select *, DATE_FORMAT(cast( inserted_timestamp as date), '%d.%m.%Y') as inserted_date from link where id > 290002;
Question: i like to know which method is better in terms of performance ? Because , in my first internship , i have been always desired to get the most of job done from database instead of one's application code.
Thanks in advance.
Regards,
RomiHi Mr / Miss tjacobs01,
Thanks for reply. I had alread knowledge that timestamp is subclass of date. Firstly, I wanted to know how far my x-colleague's statement is authentic.
I am completely agree with your statement
" Doing as much as you can in java / application layer makes scaling + testing SO MUCH EASIER"
So far i am performing convertion related manipulation in java classes. But i am facing some kind of java heap problem, as long as i insert data into xls sheet coz my fetched dataset contains more than 50K rows. Therefore i thought perhaps i can spare lil bit heap space. And i dont think i should let the my own java class handle larger dataset. What i want to say perhaps i can not as a single developer can achieve, with little experience, as much performance as i can achieve from database which is designed by many profis. that is why i am in favor of database query instead of cracking and parsing timestamp into date. If i am getting a ready made solution which is optimized then why should i try to reinvent the wheel again at application level.
I think now, reply to first question truly force me to ask heap related problem. But i am thinking its not good idea to ask related question in this post.
By the way : second question is : how can i insert dataset more than 50K rows into xls sheet. So far i know two methods
1 - extend java heap size on both JRE and Tomcat
2- use streams to continously transfer the data.
About 2nd method, i never used and dont know whether it is a better choice.
If you think you do not like to answer 2nd question in this post then please click on following link.
Kind Regards,
Romi -
Hi all,
how to find physical query from report here m checking like Administrator->manage session--> report-->view log
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- SQL Request:
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- General Query Info:
Repository: Star, Subject Area: AAA, Presentation: AAA
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- Cache Hit on query:
Matching Query: Created by: Administrator
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- Query Status: Successful Completion
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- Physical Query Summary Stats: Number of physical queries 1, Cumulative time 0, DB-connect time 0 (seconds)
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- Rows returned to Client 6
+++Administrator:3220000:3220011:----2011/01/03 02:51:43
-------------------- Logical Query Summary Stats: Elapsed time 0, Response time 0, Compilation time 0 (seconds)
but here m not able to find database query..how to find that query plz help
Edited by: Sonal on Jan 3, 2011 5:29 AM
Edited by: Sonal on Jan 3, 2011 5:30 AM
Edited by: Sonal on Jan 3, 2011 5:30 AMHi,
as Daan said, set the variable in Advanced tab but not on loglevel..
because, our problem is to bypass the bi-server cache.
Do this:
1. Go to Advanced tab.
2. In Prefix field(scroll down to see this field) , enter this:
SET DISABLE_CACHE_HIT = 1;
Note: Make sure that you're ended up above statement with semicolon and do not click on Set SQL option...
3. Save report, then run it..
4. After you see the query, i recommend you to take take out that prefix tag then save it again.. -
Access database query resultset in java scriptlet
Question:
1) I am Creating a web page and plotting points on the page:
2) Database query results in decimal values dec_latitude and dec_longiitude.
3) Perform calculations on lati. & long. in a java scriptlet to create a plot position (xpos, ypos).
4) Send the xpos and ypos back to the java server page
5) Use <IMG and absolute positioning to plot the point at position xpos, and ypos.
6) Repeat until all rows in the query result set have been plotted.
I don't know how to pass the dec_latitude and dec_longitude to the java scriptlet.
After the java scriptlet calculation translates the latitude and longitude
into xpos and ypos, I need to pass the xpos and ypos back to the java server page so that a data point is plotted on a map at position xpos, ypos.
I tried many ways of doing it but am just guessing as
to how to pass the data.
Thanks in Advance. - John
Here is what I am trying so far .... see snippet below:
The code below results in a runtime error.
Am I supposed to create a java object and access that in the java scriptlet? Can the java scriptlet access the latvar and longvar created during the "<c:set var="latvar"... ?
If not, what mechanisum do I use to access the resulting colums: dec_latitude and dec_longitude? I need the java scriptlet to convert the
dec_latitude and dec_longitude into a display position based on the number of pixels from the TOP and LEFT (xpos, ypos). Then plot of the data point using the IMG and (xpos, ypos). This will overlay a map whose z-index is lower than the plotted data point.
*** Query the database ***
<sql:query var="qryBio">
SELECT
DEC_LATITUDE,
DEC_LONGITUDE,
ENTRY_TIMESTAMP
FROM app.biosurvey where
</sql:query>
*** for each row retreived from the database ***
<c:forEach var="row" items="${qryBio.rows}">
<c:set var="latvar" value="${row.dec_latitude}" scope="page"/>
<c:set var="longvar" value="${row.dec_longitude} "scope="page" />
*** java code scriptlet - ***
*** convert latitude and longitude to xpos and ypos for display ***
<%
latitude = (Float)pageContext.getAttribute("latvar"); <--- runtime error !!!!
longitude = (Float)pageContext.getAttribute("longvar");
xpos = (int)Math.round(latitude);
ypos = (int)Math.round(longitude);
xpos = 1082 - xpos;
ypos = 700 + ypos;
pageContext.setAttribute("xpos", xpos);
pageContext.setAttribute("ypos", ypos);
%>
*** plot a point on the display html page overlaying the map ***
<IMG ID="Row" SRC="smallredbox.jpg" ALT="red box"
STYLE="position:absolute;
top:<%=xpos%> px;
left:<%=ypos%> px;
z-index:2">
</c:forEach>Thanks
I still get a runtime error: I translated the code you gave to code below .... which I think is equivalent. See Below: I'm still learning about this stuff so I may not have not translated this properly. Do
you see what I am doing wrong?
Best Regards,
- John
%@ page language="java" contentType="text/html;
charset=ISO-8859-1"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import="java.lang.Math"%>
<sql:setDataSource dataSource="jdbc/SampleDB" />
<c:set var="genus_name" value="${param.genus_name}" />
<c:set var="species_name" value="${param.species_name}" />
<c:set var="species_common_name" value="${param.species_common_name}" />
<c:set var="dd_sighted" value="${param.dd_sighted}" />
<c:set var="mm_sighted" value="${param.mm_sighted}" />
<c:set var="yyyy_sighted" value="${param.yyyy_sighted}" />
<c:set var="species_state" value="${param.species_state}" />
<c:set var="species_county" value="${param.species_county}" />
<c:set var="species_country" value="${param.species_country}" />
<c:set var="dec_latitude" value="${param.dec_latitude}" />
<c:set var="dec_longitude" value="${param.dec_longitude}" />
<c:set var="notes" value="${param.notes}" />
<c:set var="person_first_name" value="${param.person_first_name}" />
<c:set var="person_last_name" value="${param.person_last_name}" />
<c:set var="person_street" value="${param.person_street}" />
<c:set var="person_city" value="${param.person_city}" />
<c:set var="person_state" value="${param.person_state}" />
<c:set var="person_zip" value="${param.person_zip}" />
<c:set var="person_country" value="${param.person_country}" />
<c:set var="person_email" value="${param.person_email}" />
<h2>Species Sightings:</h2>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Breckenridge Citizen Bio-Survey Selective Output Page</title>
</head>
<body>
Izaak Walton League of America
<h1>Breckenridge Citizen Bio-Survey Selective Output</h1>
<HR>
<c:if test="${param.action == 'Submit'}">
<%int xpos = 0;
int ypos = 0;
float latitude = 0.0F;
float longitude = 0.0F;
float latitudeMpls = 45.06F;
float longitudeMpls = -93.14F; int xposMpls = 1205 - (int) Math.round(latitudeMpls);
int yposMpls = 735 + (int) Math.round(longitudeMpls);
%>
<IMG SRC="minnesota_1990.jpg" ALT="minesota map" style="z-index:1;"> <----- THIS WORKS FINE
<IMG ID="Row" SRC="smallredbox.jpg" ALT="red box"
STYLE="position:absolute;
top:<%=xposMpls%> px;
left:<%=yposMpls%> px;
z-index:2"> <----- THIS WORKS FINE FOR HARDCODED MPLS XPOS AND YPOS
<sql:query var="qryBio">
SELECT
PERSON_FIRST_NAME,
PERSON_LAST_NAME,
GENUS_NAME,
SPECIES_NAME,
SPECIES_COMMON_NAME,
SPECIES_COUNTY,
SPECIES_STATE,
SPECIES_COUNTRY,
DD_SIGHTED,
MM_SIGHTED,
YYYY_SIGHTED,
DEC_LATITUDE,
DEC_LONGITUDE,
NOTES,
ENTRY_TIMESTAMP
FROM app.biosurvey where
genus_name like rtrim(upper('${genus_name}')) AND
species_name like rtrim(upper('${species_name}')) AND
species_common_name like rtrim(upper
('${species_common_name}')) AND
species_state like rtrim(upper('${species_state}')) AND
species_county like rtrim(upper('${species_county}')) AND
species_country like rtrim(upper('${species_country}')) AND
person_first_name like rtrim(upper('${person_first_name}')) AND
person_last_name like rtrim(upper('${person_last_name}')) AND
person_email like rtrim(upper('${person_email}'))
</sql:query>
<c:forEach var="row" items="${qryBio.rows}">
<--- THE LINE ABOVE WORKS FINE --->
<c:set var="latvar" value="${row.dec_latitude}" scope="page" />
<c:set var="longvar" value="${row.dec_longitude} " scope="page" />
<%
latitude =
Float.parseFloat((String)pageContext.getAttribute("latvar"));
<--- RUNTIME ERROR OCCURS HERE --- SEE LINE ABOVE --->
longitude =
Float.parseFloat((String)pageContext.getAttribute("longvar"));
xpos = (int) Math.round(latitude);
ypos = (int) Math.round(longitude);
xpos = 1082 - xpos;
ypos = 700 + ypos;
request.setAttribute("xpos",new Integer(xpos));
request.setAttribute("ypos",new Integer(ypos));
%>
IIMG ID="Row" SRC="smallredbox.jpg" ALT="red box"
STYLE="position:absolute;
top:<%=xpos%> px;
left:<%=ypos%> px;
z-index:2">
<--- THIS (ABOVE) WORKS FINE WITH CORRECT VALUES FOR XPOS AND YPOS WHEN RUNTIME ERROR DOES NOT OCCUR --->
</c:forEach>
</c:if> -
I have created a web page with a photo gallery of thumbnails that link to bigger images when you hover over them. When the bigger image opens there is an odd shape at the bottom right hand side , that when pressed, will take me back to the home page. But its not the correct sought of button or symbol. I dont know how to set this up properly. I have linked J.Query style sheets. But must have missed something. Can anyone help??? this is my first web page design. It is all done except for this.
Very sensible advice. However, the second sentence in the following statement is incorrect:
1. Make sure that you have updated all recordsets to the latest (CS4) version. Older ones created before the GetSQLValueString function was introduced are vulnerable.
The GetSQLValueString() function has always existed in Dreamweaver server behavior code. However, versions of this function prior to Dreamweaver 8.0.2 are vulnerable to SQL injection.
Unfortunately, you can't update older server behaviors simply by deleting the old version of the function and replacing it with one from DW 8.0.2 or later. Other small changes were made in the server behavior code for compatibility with the revised function. PHP server behaviors created prior to DW 8.0.2 need to be deleted and rebuilt. Yes, it's a pain, but far less of a pain than being hacked. -
Word Wrap database query results
In Visual Studio 2005, when you are looking at the results of a database query, or table (show table data) etc., how can you make the results field values wrap like we use to be able to do in VS 2003 and in Visual Interdev.
If the field values were longer then what was display in the grid output results, you could expand the column width and row height and the field values would wrap to fit. If I try to do the same thing in VS 2005 or in sql enterprise manager 2005 the field values don't wrap, they remain displayed in one long line and they just get cut off after a specific number of characters.I'm a Program Manager on the SQL Server Manageability team. We own SQL Server Management Studio. Sorry to hear about your frustration with our product. The team had many tasks to complete in the SQL Server 2005 timeframe and there are some usability improvements that seem simple and were overlooked. We are committed to improving our customers' experience with our products.
I would recommend that you go to http://connect.microsoft.com/SQLServer/ and file this issue. You'll be able to track it throughout its lifecycle. Once we have a solution for the scenario, we will let you know which release of SQL Server in which you will be able to see your suggestion.
So, yes, we are listening :)
Paul A. Mestemaker II
Program Manager
Microsoft SQL Server
http://blogs.msdn.com/sqlrem/
Maybe you are looking for
-
Loading complex report data into a direct update DSO using APD
Dear All, Recently, I had a requirement to download the report data into a direct update DSO using an APD. I was able to perform this easily when the report was simple i.e it has few rows and columns. But I faced problems If the report is a complex o
-
Why when i open mail on iPad i can't see it at work on windows
when i look at emails at home on my ipad they dont show up the next day at work on my windows computer. if i dont open them then i can see them but i open them they dissapear. can anyone help me with this? thanks
-
Blue Screen Error after Synching
I had Blackberry Desktop Manager 7 installed on my WIndows XP machine...I have been getting Blue screen errors frequently after my Outlook is synched wiht the device..I was on BDM 6 prior to this and used to consistently get Blue Screen Errors. I us
-
Special characters such as è and À are not displayed correctly on my iphone but are no problem in my Outlook. Emails are sent from a blackberry Z10 Thanks
-
Dell Ultrasharp U2410 WFP or HP2475W for my new MacPro?
I purchased a new MacPro quadcore 2.8. I use Adobe Illustrator CS5 and Adobe Elements to make Fishing and Diving charts printed on sheet fed presses. I am looking for a 24" to 27", 16:10 aspect ratio monitor for this new system and cannot deal with t