sätta variabel till null

ASP

1 svar · 235 visningar · startad av mattiasnordin

Medlem sedan maj 20012 080 inlägg
Trådstart#1

Hej.

Jag har ett fält i en access 2003 databas som ska vara antingen null eller en siffra.

Nu undrar jag hur jag ändrar tillbaka till null efter att jag har satt en siffra.

Hur ser syntaxen ut? Måste det stå null i sql frågan eller går det att

id sSetThisIdToMaster = "" then 
sSetThisIdToMaster = null 
end if
sql_question = "INSERT INTO T_temp (sidan_html, huvud_meny_id, sub_meny_till_sida_id, fil_katalog_path, default_sida, lank_namn, visa_publikt, orginal_sida_id, site_id, sidan_uppdaterad_datum) "
	sql_question = sql_question &" VALUES "
	sql_question = sql_question &"('" &sHtmlSidan &"',"
	sql_question = sql_question &"" &sHuvudMenyId &","
'	sql_question = sql_question &""	&null&","
	sql_question = sql_question &""	&sSetThisIdToMaster &","
	sql_question = sql_question &"'',"
	sql_question = sql_question &"'" &sDefaultSida &"',"
	sql_question = sql_question &"'" &sLankNamn &"',"
	sql_question = sql_question &"" &sVisaPublikt &","
	sql_question = sql_question &"" &sValdSidaId &","
	sql_question = sql_question &"" &sSiteId &","
	sql_question = sql_question &"'" &now &"')"
	response.write "<hr><b>DEBUG Insert ny text i skarpa databasen:</b> " &sql_question &"<hr>"
	connect.execute(sql_question)
Medlem sedan juni 200032 967 inlägg
#2

Det måste stå null i SQL-frågan, vilket innebär att du måste använda strängen null.

id sSetThisIdToMaster = "" then 
sSetThisIdToMaster = "null" 
end if
378 ms totalt · 4 externa anrop · v20260731065814-full.d34c6d5a
125 ms — deklarationer (db)
123 ms — hämta statistik (db)
127 ms — hämta tråd, inlägg och bilagor (db)
120 ms — ändringar (db)