Hi,
I want to store a print msg in vb.net lable text..
my stored procedure is (it works fine)
Code:setANSI_NULLSON setQUOTED_IDENTIFIERON go ALTERprocedure [dbo].[SP_UserAdd] --Pass the Argument for Stored Procedure @UserID nvarchar(50), @UserPassword nvarchar(50), @UserType nvarchar(50), @UserFullName nvarchar(50) AS --Declare the Variable for Stored Procedure declare @UserID_Check_Dup asnvarchar(50) begin set @UserID_Check_Dup =(select UserID from TblMUser where UserID = @UserID) if @UserID_Check_Dup = @UserID Begin Print N'This user is already in database' End else Begin --Add new UserID insertinto TblMUser(UserID,UserPassword,UserType,UserFullName) values(@UserID,@UserPassword,@UserType,@UserFullName) Print N'User has been created successfully' End end
my VB.net code for click Event. actually procedure is runing fine.. and data is storing in DB but i want to show my stored procedure input message in my VB.net labl.text.....
Please help any one because i am new in this vb.net..Code:ProtectedSub Btn_CreateUser_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles Btn_CreateUser.Click Try If Trim(Txt_UserID.Text) <> ""And Trim(Txt_UserPassword.Text) <> ""And Trim(DD_UserType.Text) <> "--Select--"And Trim(Txt_UserFullName.Text) <> ""Then objConn = New SqlConnection objConn.ConnectionString = strConnString objConn.Open() Dim ds As DataSet = New DataSet() strSQL = "exec SP_UserAdd '" & Trim(Txt_UserID.Text) & "','" & Trim(Txt_UserPassword.Text) & "','" & Trim(DD_UserType.Text) & "','" & Trim(Txt_UserFullName.Text) & "'" da = New SqlDataAdapter(strSQL, objConn) da.Fill(ds, "KK") Me.Lbl_Error.Visible = False Me.Lbl_Successful.Visible = True Me.Lbl_Successful.Text = ds.Tables("0").Rows(1)(1).ToString Else Me.Lbl_Successful.Visible = False Me.Lbl_Error.Visible = True Me.Lbl_Error.Text = "Please select all mandatory fields" EndIf Catch ex As Exception Me.Lbl_Successful.Visible = False Me.Lbl_Error.Visible = True Me.Lbl_Error.Text = ex.Message EndTry EndSub
Regards,
Krishna
9560305552


LinkBack URL
About LinkBacks




Reply With Quote



Bookmarks