vb.net异常处理,急,在线等....
PublicFunctionfuzzySelect(ByValUserNameAsString)AsDataSetDimconAsNewSqlConnectioncon....
Public Function fuzzySelect(ByVal UserName As String) As DataSet
Dim con As New SqlConnection
con.ConnectionString = dbhelper.Constring
Try
Dim cmd As New SqlCommand
cmd.Connection = con
cmd.CommandText = "Proc_SelectEmplyByName"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@Ename", UserName)
con.Open()
Dim da As New SqlDataAdapter(cmd.CommandText, con.ConnectionString)
Dim ds As New DataSet
da.Fill(ds, "SelectUserByName")
Return ds
Catch ex As Exception
MsgBox(ex.Message)
Throw ex
Finally
con.Close()
con.Dispose()
End Try
End Function
谁能帮我看看啊。。。。急、、、、这个参数我明明是配置过了的,但是他总是报错说我没有配置参数
create proc Proc_SelectEmplyByName --按姓名模糊查询
@Ename varchar(20)
as
begin
select Eid,Ename,Eage,Esex,EidCard,Emobil,Eaddress,LastLoginTime from tbl_Emply where Ename like '%'+@Ename+'%'
end
这是我的存储过程,谢谢各位大侠了.. 展开
Dim con As New SqlConnection
con.ConnectionString = dbhelper.Constring
Try
Dim cmd As New SqlCommand
cmd.Connection = con
cmd.CommandText = "Proc_SelectEmplyByName"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@Ename", UserName)
con.Open()
Dim da As New SqlDataAdapter(cmd.CommandText, con.ConnectionString)
Dim ds As New DataSet
da.Fill(ds, "SelectUserByName")
Return ds
Catch ex As Exception
MsgBox(ex.Message)
Throw ex
Finally
con.Close()
con.Dispose()
End Try
End Function
谁能帮我看看啊。。。。急、、、、这个参数我明明是配置过了的,但是他总是报错说我没有配置参数
create proc Proc_SelectEmplyByName --按姓名模糊查询
@Ename varchar(20)
as
begin
select Eid,Ename,Eage,Esex,EidCard,Emobil,Eaddress,LastLoginTime from tbl_Emply where Ename like '%'+@Ename+'%'
end
这是我的存储过程,谢谢各位大侠了.. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询