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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display @@identity in alert box 2

Status
Not open for further replies.

richey1

Technical User
Oct 5, 2004
184
0
0
GB
hi

i have written an insert statement which then reults the id using

Code:
	Set MyRS = Server.CreateObject("ADODB.Recordset")
	MyRS.Open SQLstmt, dbconnSQL
	SQLstmt = "SELECT @@Identity FROM dbo.user_request"
	Set myRS = dbconnSQL.Execute(SQLstmt)
	varNewID = myRS(0)

how can i put the value in an alert box using javascript ?

thanks
ian
 
Code:
<script type="text/javascript">
var myId = <%= varNewID %>;
</script>

-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
i like your sleeves...they're real big
 
You must generate the Javascript dynamically. Just like you display facts pulled from the database on the web page, you can write lines of code in the Javascript.

Like so-
Code:
<script>
...
var NewID = <%= myRS(0) %>;
alert("Show me the new ID: " + NewID );
...
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top