加上<%@Page Language="VB"%> <script>中的代码最好放到Page_Load中sqlconnection改为SqlConnection sqlcommand改为SqlCommand open 改为Open 如下 <script language=vb runat=server> Sub Page_Load() dim connstring,commstring as string dim myconnection as SqlConnection dim mycommand as SqlCommand dim dr as datareader connstring="server=localhost,database=pubs" commstring="select * from authors" myconnection=new SqlConnection(connstring) mycommand=new SqlCommand(commstring,myconnection) mycommand.activeconnection.Open mycommand.exeute(dr) End Sub </script>
dr=mycommand.(...)
还有,你的连接字符串是否正确。
<script>中的代码最好放到Page_Load中sqlconnection改为SqlConnection
sqlcommand改为SqlCommand
open 改为Open
如下
<script language=vb runat=server>
Sub Page_Load()
dim connstring,commstring as string
dim myconnection as SqlConnection
dim mycommand as SqlCommand
dim dr as datareader
connstring="server=localhost,database=pubs"
commstring="select * from authors"
myconnection=new SqlConnection(connstring)
mycommand=new SqlCommand(commstring,myconnection)
mycommand.activeconnection.Open
mycommand.exeute(dr)
End Sub
</script>
我是按书上面写的?以前的beta 版和现在不一样了吗?