在 System.ArgumentException 中第一次偶然出现的“System.Data.dll”类型的异常

believebowps believebowps 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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”类型的异常

谢谢各位
...全文
评论 2
收藏 已收藏
分享
返回顶部
believebowps
VB 16,718 成员 110,520 内容