创建用户过程不在表单上工作 [英] Create User Procedure not working on form
问题描述
大家好。
创建一个用户登录表单,非常简单。
Created a user Login Form, very simple.
为此创建了一个存储过程如下
Created a Stored Procedure for this as follows
CREATE PROCEDURE CreateUser
@UserName NVARCHAR(50),
@Password NVARCHAR(50)
AS
INSERT INTO dbo.User_Login(UserName, Password) VALUES(@UserName, @Password)
RETURN 0
如果我从程序执行它可以正常工作。
If I execute from procedure it works fine.
创建表单并添加代码后,我收到错误。
After creating a form and adding code I get an error.
用于INSERT INTO的代码
Code used to INSERT INTO
Private doAction As New MethodsDataContext
Private Sub Register_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Register_btn.Click
Try
doAction.CreateUser(txtRegUser.Text, txtRegPass.Text)
MsgBox("User Created Successfully")
Catch ex As Exception
MsgBox("An Error Happened" & ", " & ex.Message)
End Try
End Sub
错误信息是。发生错误,用户登录失败
Error Message is . An Error Happened, Login Failed For User
我认为它与服务器连接有关,因为错误显示"登录失败"
I think it has something to do with the server connection as the error says 'Login Failed'
As我之前说过,在执行方法并输入"UserName"时,工作正常。和"密码"
As I said before, works fine when executing the method and imputing the "UserName" and "Password"
我放了一个断点@doAction,txtRegUser和txtRegPass中的Text在内存中。
I put a breakpoint @doAction and the Text in txtRegUser and txtRegPass is in memory.
任何人都有任何想法我做错了什么?
Anyone got any ideas what I've done wrong?
干杯
Nick
推荐答案
嗨尼克,
欢迎来到MSDN论坛。
Welcome to the MSDN forum.
看来你的问题是关于Windows Forms开发,我们的论坛是讨论VS IDE,我会帮你把这个帖子移到相应的论坛上以获得更好的支持,谢谢你的理解。
It seems your issue is about the Windows Forms development and our forum is to discuss the VS IDE, I will help you move this thread to the appropriate forum for a better support, thank you for your understanding.
祝你好运,
Sara
这篇关于创建用户过程不在表单上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!