调用存储过程传统的ASP页面 [英] Calling Stored Procedure on classic ASP page

查看:146
本文介绍了调用存储过程传统的ASP页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在挣扎了一整天,从一个传统的ASP页面调用存储过程。我有几个基本的noobie的问题。

I've been struggling all day calling a Stored Procedure from a classic ASP page. I have a few basic noobie questions.

首先,这是一个参数添加到我的命令的最佳方式:

First, is this the best way to add a parameter to my command:

cmd.Parameters.Append cmd.CreateParameter("@SubmissionDate", adDBTimeStamp, adParamInput, , txtDate)

二是adDbTimeStamp正确的类型时使用的映射在我的存储过程的参数SMALLDATETIME?

Second, is adDbTimeStamp the proper type to use when mapping to a smalldatetime parameter in my Stored Procedure?

三,我该如何传递一个空日期为datetime存储过程?

Third, how do I pass a null date to a datetime stored procedure?

此外,什么编辑器是流行的传统的ASP的发展。有人告诉我使用Dreamweaver(CS4买的),但我真的有一些性能问题,并在降级到强大的记事本。

Also, what editors are popular for classic ASP development. I was told to use Dreamweaver (bought CS4) but I'm really having some performance issues and have downgraded to the mighty NotePad.

谢谢!

推荐答案

adDBTimeStamp 是传递一个日期,并使用追加/ CreateParameter正确的数据类型是最好的方法来创建参数。

The adDBTimeStamp is the correct data type for passing in a datetime and using Append/CreateParameter is the best way to create the parameter.

但是将 txtDate 是一个字符串?你真的应该首先将其转换为一个Date类型。那不是一个简单的,因为它的声音,除非你可以非常肯定进入表单上的数据时使用的日期格式。

However would txtDate be a string? You should really convert this to a Date type first. Thats not a easy as it sounds unless you can be very sure of the date format used when entering the data on the form.

要传入null刚刚更换了与空前pression值的参数: -

To pass in null just replace the parameter with the Null expression value:-

cmd.Parameters.Append cmd.CreateParameter("@SubmissionDate", adDBTimeStamp, adParamInput, , null)

我使用VS2005 / 2008编辑大多数ASP,但我喜欢记事本+ +游逛时,我要赶紧调整一些东西。

I use VS2005/2008 to edit most ASP but I like to have Notepad++ hanging around when I want to tweak something quickly.

这篇关于调用存储过程传统的ASP页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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