asp-classic

classic asp stored procedures parameters

纵然是瞬间 提交于 2019-12-05 19:15:30
I've been looking around how to call a stored procedure from classic asp and pass a parameter into it below is my stored procedure which works fine CREATE PROCEDURE Paging_Movies @alphaChar char(1) AS if @alphaChar = '#' select * from Movies where movies like '[^a-z]%' else select * from Movies where movies like @alphaChar + '%' and my vbscript code so far - Set objCon = CreateObject("ADODB.Connection") Set objRS = CreateObject("ADODB.Recordset") set objComm = CreateObject("ADODB.Command") objCon.Open "Provider=SQLOLEDB.1;Password=xxxx;Persist Security Info=True;User ID=xxxx;Initial Catalog

replace spaces with   from a recordset

南笙酒味 提交于 2019-12-05 18:48:37
hi guys how will i be able to change "spaces" on records being returned by a recordset. for example I have this code that will return a value of "John Doe": <td width="30%"><%=rsTmp("Name")%></font></td> What I would like to do is to change the space between the words into:   so that when my page got congested the name "John Doe" will still be in a straight line and will not be separated. Thanks in advance! In Classic ASP you will need to code the following: <%= Replace(rsTmp("Name")," "," ") %> Which is the same as <% Response.Write ( Replace(rsTmp("Name")," "," ") ) %> Actually, I would

Error when accessing cookies when a cookies without a name exists

99封情书 提交于 2019-12-05 18:37:20
On a few of the Classic ASP websites I manage for the last few days I have been getting some error notifications (with no error number) that always show an error on a line number where a cookie value is being requested. Looking at the request for each of these errors, they all have unusual cookies, and look like some sort of hack attempt. The lines that are indicated as causing the error are all like this: strCookieCart = Request.Cookies("cart") Here's a couple of samples of the cookies being sent (truncated)... Note the =true (no name, just a value). HTTP_COOKIE:=true; yuv=u97Yoe-o0UWp7ho

How to format a datetime with minimal separators and timezone in VBScript?

别等时光非礼了梦想. 提交于 2019-12-05 17:25:37
I have the following code in C#: DateTime dt = GetDateTime(); string formatted = dt.ToString("yyyyMMddTHHmmsszz"); which returns a date in the following format: 20100806T112917+01 I would like to be able to get the same results in VBScript (for a legacy ASP application). It is especially important that I get the UTC offset information, or have the time converted to UTC. How do I do that? For date formatting, I like using the .NET StringBuilder class from VBScript: Option Explicit Dim sb : Set sb = CreateObject("System.Text.StringBuilder") sb.AppendFormat "{0:yyyyMMddTHHmmsszz}", Now() Response

ASP Classic - Recordset Object vs. Command Object

痞子三分冷 提交于 2019-12-05 17:09:56
I am using ASP Classic and SQL Server 2000 to create dynamic websites. I am a bit confused about when to use a recordset object and when to use a command object when querying the database. I was told that if the stored procedure would be returning records from a SELCT statement then I should use a recordset, however if I am up updating or inserting then I should use a command object and pass all data as parameters to the stored procedure. When using a recordset I often pass any required data like so: rs.Source = "spTest " & id I alway validate the data that I am passing to make sure it is what

Opening a new window create a new session

不问归期 提交于 2019-12-05 15:28:45
We are upgrading a web-based software from Windows XP with Internet Explorer 6 to Windows 7 with Internet Explorer 9. Furthermore, a webbrowser object is used inside a WPF application. We now have a strange behavior, when opening a window with a url (with an instruction like window.open(url)), the ASP session is "lost" and the new window works with a new from scratch session. I solved this issue by avoiding useless windows opening and instead, I modify the location of the current window. But I would like to understand why this behavior ! Do you have any clue ? Thank you. This could be cause by

Cannot connect from Classic ASP to SQL Server 2008 R2 using SQL Native Client (Windows 7 - IIS7)

佐手、 提交于 2019-12-05 15:18:43
问题 I'm able to connect to SQL server 2008 R2 when I use Provider=SQLOLEDB in my connection string. But when I use Provider=SQLNCLI in connection string I'm unable to connect. ADODB.Connection error '800a0e7a' Provider cannot be found. It may not be properly installed. /test.asp, line 7 Code written within test.asp is below <% Set cn = Server.CreateObject("ADODB.Connection") 'Doesn't work cn.Open "Provider=SQLNCLI;Server=remoteServer\SQL2008R2;Database=DB;UID=MyUser;PWD=pa55word;" 'Works

FileSystemObject - Reading Unicode Files

让人想犯罪 __ 提交于 2019-12-05 15:17:28
问题 Classic ASP, VBScript context. A lot of articles including this Microsoft one, say you cannot use FileSystemObject to read Unicode files. I encountered this issue a while back, so switched to using ADODB.Stream instead, per the ReadText example here, instead of using FileSystemObject.OpenTextFile (which does accept a final parameter indicating whether to open the file as unicode, but actually doesn't work). However, ADODB.Stream results in a world of pain when trying to read a file on a UNC

ASP Session variables: Is “” same as IsEmpty?

一世执手 提交于 2019-12-05 14:58:41
In ASP an uninitialized Session variable Is Empty. I know that the correct way to check for a Session value, and remove a value, is the following: IF NOT IsEmpty(Session("myVar")) THEN ' Go ahead and use Session("myVar") ... ' Now if we're all done with myVar then remove it: Session.Contents.Remove("myVar") END IF I've inherited a codebase where Application and Session variables are typically set = "" after use, and all tests for a value are of the form (Sessions("myVar") = "") . This test appears to work when the Session variable has not been declared ... or maybe it's just working by dumb