[求助]标准表达式中数据类型不匹配(眼镜都花了)
<script runat="server">Sub enter_click(ByVal sender As Object, ByVal e As EventArgs)
If uploadfile.PostedFile.FileName <> "" And tbintro.Text <> "" Then
Dim txtname, txtintro, txttype As String
Dim txtlength As Long
txtname = Path.GetFileName(uploadfile.PostedFile.FileName)
txtlength = uploadfile.PostedFile.ContentLength
txttype = uploadfile.PostedFile.ContentType
txtintro = tbintro.Text
Dim buffer(txtlength) As Byte
Dim objstream As Stream
objstream = uploadfile.PostedFile.InputStream
objstream.Read(buffer, 0, txtlength)
Dim conn As New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=" & Server.MapPath("shop.mdb"))
Dim cmd As New OleDbCommand("insert into picture(filename,filesize,filebody,fileintro,submittime,filecontenttype) values(@filename,@filesize,@filebody,@fileintro,@submitdate,@filecontenttype)", conn)
cmd.Parameters.Add(New OleDbParameter("@filename", OleDbType.Char, 50))
cmd.Parameters("@filename").Value = txtname
cmd.Parameters.Add(New OleDbParameter("@filesize", OleDbType.Integer))
cmd.Parameters("@filesize").Value = txtlength
cmd.Parameters.Add(New OleDbParameter("@filebody", OleDbType.Binary))
cmd.Parameters("@filebody").Value = buffer
cmd.Parameters.Add(New OleDbParameter("@fileintro", OleDbType.Char, 250))
cmd.Parameters("@fileintro").Value = tbintro.Text
cmd.Parameters.Add(New OleDbParameter("@submitdate", OleDbType.Date))
cmd.Parameters("@submitdate").Value = Now()
cmd.Parameters.Add(New OleDbParameter("@filecontenttype", OleDbType.Char, 50))
cmd.Parameters("@filecontenttype").Value = txttype
conn.Open()
cmd.ExecuteNonQuery()' 标准表达式中数据类型不匹配
conn.Close()
End If
End Sub
</script>