我用insert语句可以用,可是update语句却不能用,提示“System.Data.SqlClient.SqlException”类型的异常,其它信息:系统错误
请个位高手帮帮忙啊,小弟在这先谢谢啦................
代码如下:
Dim conn As New SqlConnection("server=.;database=HRMIS;integrated security=sspi")
Dim comm As New SqlCommand
Dim ds As New DataSet
Dim da As New SqlDataAdapter
Dim str As String
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
Dim buffer(fs.Length) As Byte
fs.Read(buffer, 0, CInt(fs.Length))
' str = "insert into carmessage(carHost,carNum,[photoName],[carPhoto]) values (123,456,@name,@image)"
str = "update carmessage set [photoName] = @name,[carPhoto] = @image where carHost = 123"
comm.CommandType = CommandType.Text
comm.CommandText = str
comm.Parameters.Add("@name", SqlDbType.VarChar).Value = TextBox1.Text
comm.Parameters.Add("@image", SqlDbType.Image).Value = buffer
comm.Connection = conn
'da.SelectCommand = comm
'da.Fill(ds, "carmessage")
comm.ExecuteNonQuery() 出错的行
conn.Close()
[此贴子已经被作者于2006-11-11 13:12:17编辑过]