在 System.ArgumentException 中第一次偶然出现的“System.Data.dll”类型的异常
Dim strcnn As String = "sever=192.168.0.66;database=zjc_netconfer;user id=maverickjj;password=zsjyc;"
Dim myconnection As New SqlConnection(strcnn)
Dim mycommand As New SqlCommand("sp_sd_career_news", myconnection)
'使用存储过程
mycommand.CommandType = CommandType.StoredProcedure
' 向存储过程添加参数
Dim prmUnit_title As New SqlParameter("@title", SqlDbType.VarChar, 250)
prmUnit_title.Value = unit_title
mycommand.Parameters.Add(prmUnit_title) '信息标题
Dim prmusername As New SqlParameter("@username", SqlDbType.VarChar, 250)
prmusername.Value = username
mycommand.Parameters.Add(prmusername) '信息发布人
Try
myconnection.Open()
mycommand.ExecuteNonQuery()
myconnection.Close()
Catch SQLexc As SqlException
MessageBox.Show("添加失败,原因:" & SQLexc.ToString())
End Try
-----------------------------存储过程
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER procedure [dbo].[sp_sd_career_news]
@title varchar(250),
@username varchar(250)
as
begin
insert into sd_career_news(unit_title,username)
values(@title,@username)
end
------------
以上是我的代码,我看了很多遍,应该没有错吧
但为什么一运行就会提示 在 System.ArgumentException 中第一次偶然出现的“System.Data.dll”类型的异常
谢谢各位