急!救救我呀!!我在从库里读数据时出现了以下错误!!

wanghuhua 2004-06-09 12:03:24
我的程序是:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="gb2312"%>
<%@ import namespace="system.data"%>
<%@ import namespace="system.data.sqlclient" %>
<script language="VB" runat="server">
sub page_load(obj as object,e as eventargs)
dim connstrasstring="server=whh;database=sun;userid=sun;password=sun;"
dim conn as new sqlconnection(connstr)
dim objad as sqldataadapter
dim ds as dataset

conn.open
objad=new sqldataadapter("select dpimg from prod where idx<100",conn)
ds=new dataset
objad.fill(ds)
datagrid1.datasource=ds
datagrid1.databind()
end sub
sub datagrid1_pageindexchanged(obj as object,e as datagridpagechangedeventargs)
datagrid1.currentpageindex=e.newpageindex
databind
end sub
</script>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body topmargin="0" style="background-image: url('images/pic000/bg.gif')">
<table width="780" align="center" bgcolor="#ffffff" border="0">
<tr><td>
<form ruant="server">
<table width="100%" align="center" border="0"><tr><td>
<asp:datagrid ID="datagrid1" runat="server" AutoGenerateColumns="false" AllowPaging="true" OnPageIndexChanged="datagrid1_pageindexchanged" >
<columns>
<asp:templatecolumn>
<itemtemplate>
<table width="100%" bgcolor="#ffffff">
<tr><td> <img src='<%# container.dataitem("dpimg") %>'>
</td></tr>
</table>
</itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>

</td></tr></table>
</form>
</td></tr>
</table>
</body>
</html>
就是一个简单的输出,可是出现了以下错误:
Control 'datagrid1__ctl14__ctl1' of type 'DataGridLinkButton' must be placed inside a form tag with runat=server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Control 'datagrid1__ctl14__ctl1' of type 'DataGridLinkButton' must be placed inside a form tag with runat=server.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
请大家来帮帮,谢谢,急

...全文
71 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
20040216 2004-06-09
  • 打赏
  • 举报
回复
dbase(熊猫眼)
好仔细
^_^
dbase 2004-06-09
  • 打赏
  • 举报
回复
呵呵
<form ruant="server">
应为
<form runat="server">
gongchengshi54 2004-06-09
  • 打赏
  • 举报
回复
可能你动了form了
解决方法之一:新建一个aspx,将代码原样复制过去,注意head区的东西还放在head内,form内的东西还放在form内。千万不要一骨痨复制过来呀。
lsg2002lsg 2004-06-09
  • 打赏
  • 举报
回复
;user id=sun;
dim connstr as string

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧