的VBScript / ASP经典 [英] VBScript/ASP Classic

查看:148
本文介绍了的VBScript / ASP经典的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个关于VBScript和ASP经典问题:

I have a couple of questions regarding VBScript and ASP Classic:


  1. 什么是preferred的方式来访问在VBScript / ASP的MS SQL Server数据库?

  1. What is the preferred way to access an MS SQL Server database in VBScript/ASP?

什么是问候的最佳实践从视图来自控制器分离模式?

What are best practices in regards to separating model from view from controller?

任何其他事情,我应该知道的VBScript或ASP?

Any other things I should know about either VBScript or ASP?

如果您有没有注意到,我在新的VBScript编码。我意识到数字2及3是一种巨大的黑洞的问题是过于笼统,所以不要以为我很期待去学习一切有知道从这里这两个问题。

If you haven't noticed, I'm new at VBScript coding. I realize numbers 2 & 3 are kind of giant "black hole" questions that are overly general, so don't think that I'm expecting to learn everything there is to know about those two questions from here.

推荐答案

ADO是访问在VBScript /经典的ASP数据库的好方法。

ADO is an excellent way to access a database in VBScript/Classic ASP.

Dim db: Set db = Server.CreateObject("ADODB.Connection")
db.Open "yourconnectionstring -> see connectionstrings.com"
Dim rs: Set rs = db.Execute("SELECT firstName from Employees")
While Not rs.EOF
    Response.Write rs("firstName")
    rs.MoveNext
Wend
rs.Close

此处了解详情:<一href=\"http://www.technowledgebase.com/2007/06/12/vbscript-how-to-create-an-ado-connection-and-run-a-query/\">http://www.technowledgebase.com/2007/06/12/vbscript-how-to-create-an-ado-connection-and-run-a-query/

一个需要注意的是,如果你在一个记录返回备注字段,请确保您一次只选择一个MEMO字段,并确保它是在查询的最后一列。否则,你会遇到的问题。
(参考:<一href=\"http://lists.evolt.org/archive/Week-of-Mon-20040329/157305.html\">http://lists.evolt.org/archive/Week-of-Mon-20040329/157305.html )

One caveat is that if you are returning a MEMO field in a recordset, be sure you only select ONE MEMO field at a time, and make sure it is the LAST column in your query. Otherwise you will run into problems. (Reference:http://lists.evolt.org/archive/Week-of-Mon-20040329/157305.html )

这篇关于的VBScript / ASP经典的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆