Click here to Skip to main content
15,913,685 members
Home / Discussions / Database
   

Database

 
GeneralRe: ADO + SQL statements Pin
Christian Graus23-Aug-04 10:23
protectorChristian Graus23-Aug-04 10:23 
GeneralRe: ADO + SQL statements Pin
Ryan Roberts23-Aug-04 4:44
Ryan Roberts23-Aug-04 4:44 
GeneralRe: ADO + SQL statements Pin
J. Vorstenbosch25-Aug-04 0:40
J. Vorstenbosch25-Aug-04 0:40 
GeneralAuto date colum Pin
Zee_Zee21-Aug-04 1:55
Zee_Zee21-Aug-04 1:55 
GeneralRe: Auto date colum Pin
David Salter22-Aug-04 11:43
David Salter22-Aug-04 11:43 
GeneralSQL database problem Pin
Chodici Mrkev20-Aug-04 4:04
Chodici Mrkev20-Aug-04 4:04 
GeneralRe: SQL database problem Pin
Colin Angus Mackay20-Aug-04 4:49
Colin Angus Mackay20-Aug-04 4:49 
GeneralRe: SQL database problem Pin
Chodici Mrkev20-Aug-04 6:09
Chodici Mrkev20-Aug-04 6:09 
Hi,
thank you for your reply, it helped a lot. However, I wasn't able to run it. It says this error:

Line 1: Incorrect syntax near 'RegisterUser'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near 'RegisterUser'.
Source Error:


Line 82: cmd.Connection.Open()
Line 83: cmd.Parameters.Add("@Password", inputHeslo1.Value)
Line 84: cmd.ExecuteNonQuery()
Line 85: '
Line 86: 'Dim vilemDA As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter


Source File: c:\inetpub\wwwroot\VilemWeb\Register.aspx.vb Line: 84

Here's a code:
Dim vilemConn As New SqlClient.SqlConnection<br />
vilemConn.ConnectionString = "...."<br />
<br />
Dim cmd As New SqlClient.SqlCommand("RegisterUser", vilemConn)<br />
cmd.Connection.Open()<br />
cmd.Parameters.Add("@UserName", txtLogin.Text)<br />
cmd.Parameters.Add("@Password", inputHeslo1.Value)<br />
cmd.ExecuteNonQuery()<br />
cmd.Connection.Close


and the stored procedure is here:
ALTER PROCEDURE RegisterUser<br />
	(   <br />
		@UserName   varchar(64),   <br />
		@Password   varchar(64)<br />
	)<br />
AS<br />
IF EXISTS(SELECT * FROM Users WHERE login=@UserName)<br />
BEGIN<br />
   RAISERROR('The user CurrentUser already exists', 16, 1);   <br />
   RETURN<br />
END<br />
INSERT INTO Users (login, heslo)<br />
   VALUES(@UserName, @Password)<br />
RETURN


BTW: It said an error when I had written in RAISEERROR '+@UserName+' instead of CurrentUser, don't you know why?
GeneralRe: SQL database problem Pin
Colin Angus Mackay20-Aug-04 6:26
Colin Angus Mackay20-Aug-04 6:26 
GeneralRe: SQL database problem Pin
Chodici Mrkev20-Aug-04 7:33
Chodici Mrkev20-Aug-04 7:33 
GeneralRe: SQL database problem Pin
Colin Angus Mackay20-Aug-04 7:54
Colin Angus Mackay20-Aug-04 7:54 
GeneralRe: SQL database problem Pin
Steven Campbell20-Aug-04 7:42
Steven Campbell20-Aug-04 7:42 
GeneralRe: SQL database problem Pin
Colin Angus Mackay20-Aug-04 7:55
Colin Angus Mackay20-Aug-04 7:55 
GeneralRe: SQL database problem Pin
Christian Graus22-Aug-04 15:30
protectorChristian Graus22-Aug-04 15:30 
GeneralRe: SQL database problem Pin
Colin Angus Mackay23-Aug-04 4:12
Colin Angus Mackay23-Aug-04 4:12 
GeneralEnterprise level database access in C#/.net Pin
Salil Khedkar19-Aug-04 21:36
Salil Khedkar19-Aug-04 21:36 
GeneralRe: Enterprise level database access in C#/.net Pin
Christian Graus22-Aug-04 15:27
protectorChristian Graus22-Aug-04 15:27 
GeneralDisplaying a DataGrid in child Form Pin
abhishk2001@yahoo.com19-Aug-04 13:01
abhishk2001@yahoo.com19-Aug-04 13:01 
GeneralAssembly resource not found Pin
unosinu19-Aug-04 6:00
unosinu19-Aug-04 6:00 
GeneralRe: Assembly resource not found Pin
Mekong River21-Aug-04 4:57
Mekong River21-Aug-04 4:57 
GeneralSQL query with parameter and % Pin
YomYom19-Aug-04 4:58
YomYom19-Aug-04 4:58 
GeneralRe: SQL query with parameter and % Pin
Chris Meech19-Aug-04 8:29
Chris Meech19-Aug-04 8:29 
GeneralRe: SQL query with parameter and % Pin
YomYom19-Aug-04 10:23
YomYom19-Aug-04 10:23 
GeneralRe: SQL query with parameter and % Pin
Looney Tunezez19-Aug-04 11:10
Looney Tunezez19-Aug-04 11:10 
QuestionHow to store and retrieve metadata about a database table column? Pin
Salil Khedkar19-Aug-04 2:48
Salil Khedkar19-Aug-04 2:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.