Jump to content
php.lv forumi

@@IDENTITY


NBS

Recommended Posts

query = "INSERT INTO financest (custom_ID, device_NR, subsfee) VALUES ('"& customid &"', "& request("devid") &", "& request("subsfee") &")"
	   response.write(query)
	   link.execute(query)

 

Izvadās INSERT query.

 

query = "SELECT @@IDENTITY AS financ_ID"
	   response.write(query)
	   set exe = link.execute(query)
	   response.write(exe("financ_ID"))

 

Neizvadās financ_ID. Neiegūstu IDENTITY.

Palīdziet, lūdzu.

Link to comment
Share on other sites

Esi pārliecināts, ka iekš Access db tāda fiška kā @@IDENTITY vispār ir ? Es zinu, ka tas ir priekš MSSQL.

 

http://www.google.com/search?hl=en&q=a...+last+insert+id

 

Es tieši izmantoju MSSQL un palaižot iekšs SQL Query Analyzer:

 

INSERT INTO financest (custom_ID, device_NR, subsfee) VALUES ('270785', 1, 10.6)
SELECT @@IDENTITY AS financ_ID

 

Viss forši strādā :(

Link to comment
Share on other sites

Uzrakstot pat šādu kodu atgriež abos gadījumos tukšumus :(

 

	query = "SELECT @@IDENTITY AS financ_ID1"
set exe = link.execute(query)
response.write("financ_ID1: ")
response.write(exe("financ_ID1"))

	query = "SELECT SCOPE_IDENTITY() AS financ_ID2"
set hm = link.execute(query)
response.write("financ_ID2: ")
response.write(hm("financ_ID2"))

Link to comment
Share on other sites

×
×
  • Create New...