问题描述
我一直致力于将我公司的一个主要网站转换为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中看到过这样的东西。任何想法都是
欢迎。
[引用文字剪辑 - 37行]
[引用文字剪辑 - 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.
[quoted text clipped - 37 lines]
[quoted text clipped - 37 lines]
这篇关于功能名称未声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!