请问我那里出错了
这是源代码:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="p7-1.aspx.vb" Inherits="p7_1" %>
<%@ Import Namespace="System.data" %>
<%@ Import Namespace="System.data.sqlClient" %>
<script language="vb" runat=server>
Sub sendmsg(ByVal sender As Object, ByVal e As EventArgs)
If subject.Text = "" Or content.Text = "" Then '输入不能为空
LblDesc.Text = "您必须输入主题和内容"
Exit Sub
End If
Dim conn As SqlConnection = New SqlConnection("server=.;database=message;uid=sa;pwd=861016")
Dim ds As DataSet = New DataSet()
conn.Open()
Dim da As New SqlDataAdapter()
da.SelectCommand = New SqlCommand("select * from info", conn)
da.InsertCommand = New SqlCommand()
da.InsertCommand.CommandText = "insert into info(theme,SendName,Content,SendTime,huiId) values(?,?,?,?,?)"
da.InsertCommand.Connection = conn
da.InsertCommand.Parameters.Add("@zt", SqlDbType.VarChar, 50, "theme")
da.InsertCommand.Parameters.Add("@nc", SqlDbType.VarChar, 10, "SendName")
da.InsertCommand.Parameters.Add("@nr", SqlDbType.VarChar, 200, "Content")
da.InsertCommand.Parameters.Add("@sj", SqlDbType.DateTime, Nothing, "SendTime")
da.InsertCommand.Parameters.Add("@hf", SqlDbType.Int, Nothing, "huiId")
ds = New DataSet()
da.Fill(ds, "info")
conn.Close()
Dim infoTab As DataTable = ds.Tables("info")
Dim infoRow As DataRow = infoTab.NewRow()
infoRow("theme") = subject.Text
infoRow("SendName") = subject.Text
infoRow("Content") = content.Text
infoRow("SendTime") = CDate(Now())
infoRow("huiId") = 0
infoTab.Rows.Add(infoRow)
da.Update(ds, "info")
LblDesc.Text = "您已成功发帖!"
subject.Text = ""
content.Text = ""
End Sub
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<h1 align=center><font color=red face=隶书>请您输入信息</font></h1>
<form id="form1" runat="server">
<div>
<table bgcolor=beige border=1 bordercolor=black cellspacing=15>
<tr bordercolor=beige>
<td><b>主题:</b></td><td><asp:TextBox ID=subject runat=server size=60 /></td>
<td><asp:Button Text=送出消息 runat=server OnClick=sendmsg /></td></tr>
<tr bordercolor=beige>
<td colspan=3><asp:TextBox ID=content runat=server TextMode=multiline Columns=100 Rows=22 /></td>
</tr>
</table>
<br />
<asp:Label ID=LblDesc ForeColor=red runat=server />
</div>
</form>
</body>
</html>
出错信息:
第 1 行: '?' 附近有语法错误。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.SqlClient.SqlException: 第 1 行: '?' 附近有语法错误。
源错误:
行 33: infoRow("huiId") = 0
行 34: infoTab.Rows.Add(infoRow)
行 35: da.Update(ds, "info")
行 36: LblDesc.Text = "您已成功发帖!"
行 37: subject.Text = ""
源文件: D:\学习社区\大三上\ASP.NET\试验源码\p7-1.aspx 行: 35