stored proc from classic asp and ado parameter issue
am 17.03.2005 16:05:05 von gorostasREMOVE_THISHi all,
i have one asp page which picks up about 15 number values from form, and
enters it into sql server database whit float data type fiels.
my problem is how to enter NULL value into database if nothing is entered
into form, and not '0'.
i have this code which doesnt work well..
----
Set con = Server.CreateObject("ADODB.Connection")
con.open "Provider=SQLOLEDB.1;Integrated Security=SSPI" & _
";Persist Security Info=False;Initial Catalog=kandidati1;" & _
"Data Source=mvp525\NETSDK"
Set cm = Server.CreateObject("ADODB.Command")
cm.ActiveConnection = con
cm.CommandType = adCmdStoredProc
cm.CommandText = "edit_test"
cm.NamedParameters = True
cm.Parameters.Append cm.CreateParameter("@id", 200, 1, 4,
request.form("oop"))
cm.Parameters.Append cm.CreateParameter("@t1", 200, 1, 8,
request.form("test1"))
cm.Parameters.Append cm.CreateParameter("@t2", 200, 1, 8,
request.form("test2"))
cm.Parameters.Append cm.CreateParameter("@t3", 200, 1, 8,
request.form("test3"))
cm.Parameters.Append cm.CreateParameter("@t4", 200, 1, 8,
request.form("test4"))
cm.Parameters.Append cm.CreateParameter("@t5", 200, 1, 8,
request.form("test5"))
cm.Parameters.Append cm.CreateParameter("@t6", 200, 1, 8,
request.form("test6"))
cm.Parameters.Append cm.CreateParameter("@t7", 200, 1, 8,
request.form("test7"))
cm.Parameters.Append cm.CreateParameter("@t8", 200, 1, 8,
request.form("test8"))
cm.Parameters.Append cm.CreateParameter("@t9", 200, 1, 8,
request.form("test9"))
cm.Parameters.Append cm.CreateParameter("@t10", 200, 1, 8,
request.form("test10"))
cm.Parameters.Append cm.CreateParameter("@t11", 200, 1, 8,
request.form("test11"))
cm.Parameters.Append cm.CreateParameter("@t12", 200, 1, 8,
request.form("test12"))
cm.Parameters.Append cm.CreateParameter("@t13", 200, 1, 8,
request.form("test13"))
cm.Parameters.Append cm.CreateParameter("@t14", 200, 1, 8,
request.form("test14"))
cm.Parameters.Append cm.CreateParameter("@t15", 200, 1, 8,
request.form("test15"))
cm.Execute
----
and my idea was this...to remove this big block of code and make some nice
do loop function.., but i got server error page #500 internal error...or
whitout friendly HTTP error msg in internet explorer, i got "loop whit out
do..??" - WHY?
----
dim j,f,e
j=0
do until j>=16
f="@t" & j+1
e="test" & j+1
if request.form(e)="" then
cm.Parameters.Append cm.CreateParameter(f, 200, 1, 8, NULL)
else
cm.Parameters.Append cm.CreateParameter(f, 200, 1, 8, request.form(e))
j=j+1
loop
-----------
if someone can help i would be very gratefull.
thanks in advance.
--
-k.p.