ro***********@shaw.ca wrote:
i am maintaining a system that was developed using dream weaver. a lot
of the asp ado code looks like this:
set sp_yellow = Server.CreateObject("ADODB.Command")
sp_yellow.ActiveConnection = MM_MHR_CONN_STR_STRING
sp_yellow.CommandText = "Sp_HPMSQ007_GetSystemConstants"
Here is another problem: it is a bad idea to use the "sp_" prefix for
user-defined stored procedures. SQL Server assumes that procedures with
that prefix are system procedures, and will waste time looking for them
in the Master database, even if you specify the database name
explicitly. If you make the double mistake of giving your procedure the
same name as an actual system procedure, guess which one will be run
when you call it.
sp_yellow.CommandType = 4
sp_yellow.CommandTimeout = 0
sp_yellow.Prepared = true
sp_yellow.Parameters.Append
sp_yellow.CreateParameter("@RETURN_VALUE", 3, 4)
sp_yellow.Parameters.Append sp_yellow.CreateParameter("@P_NAME_TXT",
129, 1, 17, "MLSTN_YELLOW_DAYS")
set rst_yellow = sp_yellow.Execute
If you are not interested in the return value, using an explicit Command
object and appending the parameter objects is overkill.
>
someone on another forum expressed that dreamweaver "tends to drive
the programmer to creat implicit connections and their effect on
performance".
could someone explain this to me? a provide some better code? (we no
longer are required to use dream weaver to develop code for the app).
Explicit connections are best. Like this:
Set cn = CreateObject("ADODB.Connection")
cn.Open MM_MHR_CONN_STR_STRING 'ughhh
set rst_yellow = CreateObject("ADODB.Recordset")
'ugh - damn long variable names! let's fix this one
dim days
days = MLSTN_YELLOW_DAYS
cn.Sp_HPMSQ007_GetSystemConstants days, rst_yellow
If not rst_yellow.eof then
etc.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.