This topic is locked

Insert a record FROM another table...

4/23/2008 2:14:58 AM
ASPRunnerPro General questions
S
stalbone author

Hi

In ADD PAGE (into one table) i wont insert a value read FROM another table....

Is it possible?
Many thanks

Stefano

J
Jane 4/23/2008

Stefano,
use Before record added event on the Events tab for this purpose.

Here is a sample:

str = "select FieldName from TableName"

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
dict("FieldName2") = rsTemp("FieldName")

rsTemp.Close : set rsTemp = Nothing



where FieldName and FieldName2 are your actual field names. FieldName2 is field on the main add page.

A
akira_nagasaki 1/13/2009

i got this error [Oracle][ODBC][Ora]ORA-00911: invalid character
this is my code.
str = "select EMPLOYEE_NAME from IFSAPP._MV_TRS_EMPLOYEE"
Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
dict("EMPLOYEE_NAME") = rsTemp("EMPLOYEE_NAME")

rsTemp.Close : set rsTemp = Nothing
pls help <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=36740&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />

J
Jane 1/13/2009

Hi,
your code looks fine.

Try to debug it adding following line just after your code:

Response.Write "name: " & dict("EMPLOYEE_NAME")

A
akira_nagasaki 1/15/2009

Hi,

your code looks fine.

Try to debug it adding following line just after your code:


i still got the same error invalid character <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=36815&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />
is it becoz of database connection or the field itself

J
Jane 1/15/2009

Try to print SQL query before and execute it in the database directly.

str = "select EMPLOYEE_NAME from IFSAPP._MV_TRS_EMPLOYEE"

Response.Write str

A
akira_nagasaki 1/21/2009

it's not working.
the page look same as previous, but there is a text on the top of the page - select EMPLOYEE_NAME from IFSAPP._MV_TRS_EMPLOYEE

J
Jane 1/23/2009

Hi,
to debug code execute this SQL in the database directly.

A
akira_nagasaki 2/17/2009

Hi,

to debug code execute this SQL in the database directly.


hello jane,
i had debug the code and it;s still getting error.
this is the error when i execute this sql into my oracle database
ORA-00900:invalid SQL Statement
Please note that SQL plus commands are not supported. You will need to use SQL Plus Worksheet for running SQL Plus commands or scripts
do you have any idea, since i'm still with this oracle database <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=37931&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />

A
akira_nagasaki 2/18/2009



hello jane,
i had debug the code and it;s still getting error.
this is the error when i execute this sql into my oracle database
ORA-00900:invalid SQL Statement
Please note that SQL plus commands are not supported. You will need to use SQL Plus Worksheet for running SQL Plus commands or scripts
do you have any idea, since i'm still with this oracle database <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=37938&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />


jane i think i know what is the problem, it's a table name IFSAPP._MV_TRSEMPLOYEE
after. shouldn't be a
i test with another table no that doesn't have _ before. and it;'s working <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=37938&image=2&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />