功能名称未声明? [英] Function name not declared?

查看:68
本文介绍了功能名称未声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直致力于将我公司的一个主要网站转换为ASP。

net。我从微软的迁移助手开始,这可能或者可能是
不是一个好主意。它在上次转换时工作正常。


在尝试开发良好的编码实践时,我正在使用Option Strict。当我上次转换
时,我写了一个相对简单的函数,你在一个SQL字符串中传递了
,它返回了一个SqlDataReader。在这个网站上工作得非常好,但是在这个网站上我得到了以下错误:


编译器错误消息:BC30451:名称''OpenRDR''不是宣布。


来源错误:


第85行:Dim sql as String =" SELECT * FROM All_Schools WHERE

TeamName =''FRONT''"

第86行:rdr = OpenRDR(sql)

这是目前的dbsupport文件。


< script language =" VB" runat =" Server">

函数OpenRDR(ByRef sql As String)As SqlDataReader

Dim Conn As SqlConnection = new SqlConnection(ConfigurationSettings。

AppSettings(" ConnectionString"))

Dim dbComm As SqlCommand = new SqlCommand(sql,conn)

Dim rs As SqlDataReader


Conn.Open()

rs = dbComm.ExecuteReader(CommandBehavior.CloseConnecti on)

返回rs

结束函数

< / script>


我的所有阅读中都遗漏了什么?我一个星期一半只在.NET上花了大约一两美元,但我从来没有在ASP中看到过这样的东西。任何想法都是

欢迎。

解决方案

Zak,


有你的参考支持文件?


-

此致,


S. Justin Gengo,MCP

网站开发人员/程序员

www.aboutfortunate.com


混乱就是订单。

Nietzsche

" Zak" < u15629 @乌韦>在消息新闻中写道:572807c4a4f80 @ uwe ...

我一直致力于将我公司的一个主要网站转换为
ASP。
net。我从微软的迁移助手开始,可能或者
可能不是一个好主意。它在上次转换时工作正常。

在尝试开发良好的编码实践时,我正在使用Option Strict。当我完成上一次转换时,我编写了一个相对简单的函数,您在其中传递了一个SQL字符串,并返回了一个SqlDataReader。在那个网站上工作得很好
在这个网站上我得到了以下错误:

编译器错误消息:BC30451:名称''OpenRDR''未声明。

源错误:

第85行:Dim sql as String =" SELECT * FROM All_Schools WHERE
TeamName =''FRONT''"
Line 86:rdr = OpenRDR(sql)

这是目前的dbsupport文件。

< script language =" VB" runat =" Server">
函数OpenRDR(ByRef sql As String)As SqlDataReader
Dim Conn As SqlConnection = new SqlConnection(ConfigurationSettings。
AppSettings(" ConnectionString"))
Dim rs As SqlDataReader

Conn.Open()
rs = dbComm.ExecuteReader(CommandBehavior.CloseConnecti on)
返回rs
结束功能
< / script>

我在所有阅读中都遗漏了什么?我只在.NET工作了一周半,但我从来没有在ASP中看到过类似的东西。欢迎任何想法



是的先生,只是一个基本的SSI。


<! - include file =" ssi / dbsupport.aspx" - >


上面的函数是dbsupport.aspx中唯一的东西


S. Justin Gengo写道:

Zak,

请参考支持文件?

我一直在努力将我公司的一个主要网站转换为
ASP。


[引用文字剪辑 - 37行]


欢迎。



我不知道你可以在aspx页面中使用include。


将函数移动到一个类并从页面引用该类。

代码将执行得更快,因为它将被编译。


" Zak" < u15629 @乌韦>在消息新闻中写道:57283bad38138 @ uwe:

是的先生,只是一个基本的SSI。

<! - include file =" ssi / dbsupport的.aspx" - >

上面的函数是dbsupport.aspx中唯一的东西

S. Justin Gengo写道:

Zak,

请参考支持文件?

我一直在努力将我公司的一个主要网站转换为
ASP。


[引用文字剪辑 - 37行]


欢迎。




I''ve been working on converting one of the major sites in my company to ASP.
net. I started with the migration assistant from Microsoft, which may or may
not have been a good idea. It worked OK on the last conversion though.

In trying to develop good coding practices, I''m using Option Strict. When I
made my last conversion, I wrote a relatively simple function where you
passed in an SQL string, and it returned an SqlDataReader. Worked great on
that site, but on this one I get the following error:

Compiler Error Message: BC30451: Name ''OpenRDR'' is not declared.

Source Error:

Line 85: Dim sql as String = "SELECT * FROM All_Schools WHERE
TeamName=''FRONT''"
Line 86: rdr = OpenRDR(sql)
Here is the dbsupport file as it currently is.

<script language="VB" runat="Server">
function OpenRDR(ByRef sql As String) As SqlDataReader
Dim Conn As SqlConnection = new SqlConnection(ConfigurationSettings.
AppSettings("ConnectionString"))
Dim dbComm As SqlCommand = new SqlCommand(sql,conn)
Dim rs As SqlDataReader

Conn.Open()
rs = dbComm.ExecuteReader(CommandBehavior.CloseConnecti on)
return rs
end function
</script>

Have I missed something in all my reading? I''ve only been at .NET for about
a week and a half, but I never saw anything like this in ASP. Any ideas are
welcome.

解决方案

Zak,

Have your referenced the support file?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Zak" <u15629@uwe> wrote in message news:572807c4a4f80@uwe...

I''ve been working on converting one of the major sites in my company to
ASP.
net. I started with the migration assistant from Microsoft, which may or
may
not have been a good idea. It worked OK on the last conversion though.

In trying to develop good coding practices, I''m using Option Strict. When
I
made my last conversion, I wrote a relatively simple function where you
passed in an SQL string, and it returned an SqlDataReader. Worked great
on
that site, but on this one I get the following error:

Compiler Error Message: BC30451: Name ''OpenRDR'' is not declared.

Source Error:

Line 85: Dim sql as String = "SELECT * FROM All_Schools WHERE
TeamName=''FRONT''"
Line 86: rdr = OpenRDR(sql)
Here is the dbsupport file as it currently is.

<script language="VB" runat="Server">
function OpenRDR(ByRef sql As String) As SqlDataReader
Dim Conn As SqlConnection = new SqlConnection(ConfigurationSettings.
AppSettings("ConnectionString"))
Dim dbComm As SqlCommand = new SqlCommand(sql,conn)
Dim rs As SqlDataReader

Conn.Open()
rs = dbComm.ExecuteReader(CommandBehavior.CloseConnecti on)
return rs
end function
</script>

Have I missed something in all my reading? I''ve only been at .NET for
about
a week and a half, but I never saw anything like this in ASP. Any ideas
are
welcome.



Yes sir, just a basic SSI.

<!--include file="ssi/dbsupport.aspx" -->

Where the function above is the only thing in dbsupport.aspx

S. Justin Gengo wrote:

Zak,

Have your referenced the support file?

I''ve been working on converting one of the major sites in my company to
ASP.


[quoted text clipped - 37 lines]

are
welcome.



I didn''t know that you could use includes in aspx pages.

Move the function to a class and reference that class from the page.
The code will execute faster because it will be compiled.

"Zak" <u15629@uwe> wrote in message news:57283bad38138@uwe:

Yes sir, just a basic SSI.

<!--include file="ssi/dbsupport.aspx" -->

Where the function above is the only thing in dbsupport.aspx

S. Justin Gengo wrote:

Zak,

Have your referenced the support file?

I''ve been working on converting one of the major sites in my company to
ASP.


[quoted text clipped - 37 lines]

are
welcome.




这篇关于功能名称未声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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