本文介绍了声明预期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 还在学习ASP.NET ....(而且我在使用经典ASP的过程中也做得很好!)。 我正在尝试连接到SQL Server一个简单的连接脚本。 我检查了两本不同的书并查看了 www.asp.net 仍然无法 超过此错误。 任何人都可以看到错误吗?这个<脚本>示例几乎是从Sams ASP.NET Unleashed Book中逐行排列的。错误在第8行。谢谢。 编译器错误消息:BC30188:预期声明。 源错误: 第8行:DbConn =新SQLConnection(" server = drpt-server3; database = DRPT-TEST") **** ****************************** * <%@ Import Namespace =" ; System.Data.SqlClient的" %> < script runat =" server"> Dim DbConn As SQLConnection Dim MySQLCommand As SQLCommand Dim RS As SQLDataReader DbConn =新SQLConnection(" server = drpt-server3; database = DRPT-TEST") DbConn.Open() MySQLCommand = New MySQLCommand(" SELECT * FROM Staff;",DbConn) RS = MySQLCommand.ExecuteReader( ) < / script> < html xmlns =" http://www.w3.org/1999/xhtml"> < head> < title> Untitled Document< / title> < / head> < body> <% RS.MoveFirst Response.Write RS(" LastName")。值 DbConn.Close() RS.Close() %> < / body> < / html> - *************** ****************** D. Shane Fowlkes - TMM 一次拯救世界,一个网站。 http:// www .shanefowlkes.com ********************************* 解决方案 经典的ASP也是如此之好!)。 仍然无法 几乎逐行来自 8.谢谢。 数据库= DRPT-TEST") DbConn) Still learning ASP.NET....(and I was getting so good with classic ASP too!).I''m trying to connect to a SQL Server using a simple connection script.I''ve checked 2 different books and looked at www.asp.net and still cannotget past this "error".Can anyone see the error? This <script> example is almost line by line fromthe Sams ASP.NET Unleashed Book. The error is on line 8. Thanks.Compiler Error Message: BC30188: Declaration expected.Source Error:Line 8: DbConn = New SQLConnection("server=drpt-server3;database=DRPT-TEST")**********************************<%@ Import Namespace="System.Data.SqlClient" %><script runat="server">Dim DbConn As SQLConnectionDim MySQLCommand As SQLCommandDim RS As SQLDataReaderDbConn = New SQLConnection("server=drpt-server3; database=DRPT-TEST")DbConn.Open()MySQLCommand = New MySQLCommand("SELECT * FROM Staff;", DbConn)RS = MySQLCommand.ExecuteReader()</script><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Untitled Document</title></head><body><%RS.MoveFirstResponse.Write RS("LastName").ValueDbConn.Close()RS.Close()%></body></html>--*********************************D. Shane Fowlkes - TMMSaving the world, one web site at a time. http://www.shanefowlkes.com********************************* 解决方案 classic ASP too!). connection script. and still cannot almost line by line from 8. Thanks. database=DRPT-TEST") DbConn) 这篇关于声明预期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
05-16 09:53