Hi
I have created a stored procedure for registration form as
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE dbo.Pro_Login
@loginid varchar(50),
@password varchar(50),
@confirmpassword varchar(50),
@firstname varchar(50),
@lastname varchar(50),
@address varchar(200),
@address2 varchar(200),
@address3 varchar(200),
@city varchar(50),
@country varchar(50),
@province varchar(50),
@postalcode bigint,
@phone varchar(50),
@email varchar(50),
@how varchar(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
insert into login
(loginid,password,confirmpassword,firstname,lastna me,address,address2,address3,city,country,province ,postalcode,phone,email,how)
values(@loginid,@password,@confirmpassword,@firstn ame,@lastname,@address,@address2,@address3,@city,@ country,@province,@postalcode,@phone,@email,@how)
END
I have called the stored procedure in my front end as
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim str As String
str = "user id=sa;password=cast;database=jsc;server=AURORA-SERVER"
con = New SqlConnection(str)
Try
con.Open()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = " Pro_Login "
cmd.Connection = con
Dim loginid As New SqlParameter("@loginid", SqlDbType.VarChar, 50)
loginid.Value = txtLoginId2.Text.ToString()
Dim password As New SqlParameter("@password", SqlDbType.VarChar, 50)
password.Value = txtPassword1.Text.ToString()
Dim confirmpassword As New SqlParameter("@confirmpassword", SqlDbType.VarChar, 50)
confirmpassword.Value = txtConfirmPassword.Text.ToString()
Dim firstname As New SqlParameter("@firstname", SqlDbType.VarChar, 50)
firstname.Value = txtFirstName.Text.ToString()
Dim lastname As New SqlParameter("@lastname", SqlDbType.VarChar, 50)
lastname.Value = txtLastName.Text.ToString()
Dim address As New SqlParameter("@address", SqlDbType.VarChar, 200)
address.Value = txtAddress.Text.ToString()
Dim address2 As New SqlParameter("@address2", SqlDbType.VarChar, 200)
address2.Value = txtAddress2.Text.ToString()
Dim address3 As New SqlParameter("@address3", SqlDbType.VarChar, 200)
address3.Value = txtAddress3.Text.ToString()
Dim city As New SqlParameter("@city", SqlDbType.VarChar, 50)
city.Value = txtCity.Text.ToString()
Dim country As New SqlParameter("@country", SqlDbType.VarChar, 50)
country.Value = ddlCountry.Text.ToString()
Dim province As New SqlParameter("@province", SqlDbType.VarChar, 50)
province.Value = txtProvince.Text.ToString()
Dim postalcode As New SqlParameter("@postalcode", SqlDbType.BigInt)
postalcode.Value = CInt(txtPostalCode.Text.ToString())
Dim phone As New SqlParameter("@phone", SqlDbType.VarChar, 50)
phone.Value = txtPhone.Text.ToString()
Dim email As New SqlParameter("@email", SqlDbType.VarChar, 50)
email.Value = txtEmail1.Text.ToString()
Dim how As New SqlParameter("@how", SqlDbType.VarChar, 200)
how.Value = txtHow.Text.ToString()
cmd.Parameters.Add(loginid)
cmd.Parameters.Add(password)
cmd.Parameters.Add(confirmpassword)
cmd.Parameters.Add(firstname)
cmd.Parameters.Add(lastname)
cmd.Parameters.Add(address)
cmd.Parameters.Add(address2)
cmd.Parameters.Add(address3)
cmd.Parameters.Add(city)
cmd.Parameters.Add(country)
cmd.Parameters.Add(province)
cmd.Parameters.Add(postalcode)
cmd.Parameters.Add(phone)
cmd.Parameters.Add(email)
cmd.Parameters.Add(how)
cmd.ExecuteNonQuery()
Catch
End Try
End Sub
1 1266
Hi
I have created a stored procedure for registration form as
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE dbo.Pro_Login
@loginid varchar(50),
@password varchar(50),
@confirmpassword varchar(50),
@firstname varchar(50),
@lastname varchar(50),
@address varchar(200),
@address2 varchar(200),
@address3 varchar(200),
@city varchar(50),
@country varchar(50),
@province varchar(50),
@postalcode bigint,
@phone varchar(50),
@email varchar(50),
@how varchar(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
insert into login
(loginid,password,confirmpassword,firstname,lastna me,address,address2,address3,city,country,province ,postalcode,phone,email,how)
values(@loginid,@password,@confirmpassword,@firstn ame,@lastname,@address,@address2,@address3,@city,@ country,@province,@postalcode,@phone,@email,@how)
END
I have called the stored procedure in my front end as
Dim con As SqlConnection
Dim cmd As SqlCommand
Dim str As String
str = "user id=sa;password=cast;database=jsc;server=AURORA-SERVER"
con = New SqlConnection(str)
Try
con.Open()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = " Pro_Login "
cmd.Connection = con
Dim loginid As New SqlParameter("@loginid", SqlDbType.VarChar, 50)
loginid.Value = txtLoginId2.Text.ToString()
Dim password As New SqlParameter("@password", SqlDbType.VarChar, 50)
password.Value = txtPassword1.Text.ToString()
Dim confirmpassword As New SqlParameter("@confirmpassword", SqlDbType.VarChar, 50)
confirmpassword.Value = txtConfirmPassword.Text.ToString()
Dim firstname As New SqlParameter("@firstname", SqlDbType.VarChar, 50)
firstname.Value = txtFirstName.Text.ToString()
Dim lastname As New SqlParameter("@lastname", SqlDbType.VarChar, 50)
lastname.Value = txtLastName.Text.ToString()
Dim address As New SqlParameter("@address", SqlDbType.VarChar, 200)
address.Value = txtAddress.Text.ToString()
Dim address2 As New SqlParameter("@address2", SqlDbType.VarChar, 200)
address2.Value = txtAddress2.Text.ToString()
Dim address3 As New SqlParameter("@address3", SqlDbType.VarChar, 200)
address3.Value = txtAddress3.Text.ToString()
Dim city As New SqlParameter("@city", SqlDbType.VarChar, 50)
city.Value = txtCity.Text.ToString()
Dim country As New SqlParameter("@country", SqlDbType.VarChar, 50)
country.Value = ddlCountry.Text.ToString()
Dim province As New SqlParameter("@province", SqlDbType.VarChar, 50)
province.Value = txtProvince.Text.ToString()
Dim postalcode As New SqlParameter("@postalcode", SqlDbType.BigInt)
postalcode.Value = CInt(txtPostalCode.Text.ToString())
Dim phone As New SqlParameter("@phone", SqlDbType.VarChar, 50)
phone.Value = txtPhone.Text.ToString()
Dim email As New SqlParameter("@email", SqlDbType.VarChar, 50)
email.Value = txtEmail1.Text.ToString()
Dim how As New SqlParameter("@how", SqlDbType.VarChar, 200)
how.Value = txtHow.Text.ToString()
cmd.Parameters.Add(loginid)
cmd.Parameters.Add(password)
cmd.Parameters.Add(confirmpassword)
cmd.Parameters.Add(firstname)
cmd.Parameters.Add(lastname)
cmd.Parameters.Add(address)
cmd.Parameters.Add(address2)
cmd.Parameters.Add(address3)
cmd.Parameters.Add(city)
cmd.Parameters.Add(country)
cmd.Parameters.Add(province)
cmd.Parameters.Add(postalcode)
cmd.Parameters.Add(phone)
cmd.Parameters.Add(email)
cmd.Parameters.Add(how)
cmd.ExecuteNonQuery()
Catch
End Try
End Sub
Hi
I got the sol for above issue. The thing is I have changed the table name again in the above stored procedure and I have n't executed it. Thats why.
Now for Login form I created the stored procedure as
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[Pro_Login1]
@loginid varchar(50),
@password varchar(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
select count(loginid) from login where loginid=(@loginid) and password=(@password)
END
In my front end I have given the coding as
Protected Sub imgLogin_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgLogin.Click
Dim con As SqlConnection
Dim cmd As New SqlCommand
Dim str As String
Dim rd As SqlDataReader
str = "user id=sa;password=cast;database=jsc;server=AURORA-SERVER"
con = New SqlConnection(str)
Try
con.Open()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = " Pro_Login1 "
cmd.Connection = con
Dim loginid As New SqlParameter("@loginid", SqlDbType.VarChar, 50)
loginid.Value = txtLoginId.Text.ToString()
Dim password As New SqlParameter("@password", SqlDbType.VarChar, 50)
password.Value = txtPassword.Text.ToString()
cmd.Parameters.Add(loginid)
cmd.Parameters.Add(password)
cmd.ExecuteNonQuery()
Dim cnt As Int16
cnt = cmd.ExecuteScalar()
If cnt <= 0 Then
Response.Write("The login or password you entered does not match our records. Please check your entry and try again.")
Else
'Response.Write("Authorise user")
Response.Redirect("Default3.aspx")
End If
Catch ex As Exception
End Try
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Aaron |
last post by:
The following code works fine when previewing a Crystal report using
ASP, EXCEPT when it gets to a report using a SubReport and its
associated parameters. The whole report just comes up blank with...
|
by: Warren Wright |
last post by:
Hi group,
I have a select statement that if run against a 1 million record
database directly in query analyzer takes less than 1 second.
However, if I execute the select statement in a stored...
|
by: Nashat Wanly |
last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and
Visual C# .NET
View products that this article applies to.
This article was previously published under Q310070
For a Microsoft...
|
by: marc |
last post by:
I've been developing a stored procedure that uses a user defined
function in the query portion of the procedure. However, since the end
product needs to allow for dynamic table names, the UDF will...
|
by: serge |
last post by:
Using "SELECT * " is a bad practice even
when using a VIEW instead of a table?
I have some stored procedures that are
identical with the difference of one statement
in the WHERE clause. If I...
|
by: Kent Lewandowski |
last post by:
hi all,
Recently I wrote some stored procedures using java jdbc code
(admittedly my first stab) and then tried to implement the same within
java packages (for code reuse). I encountered...
|
by: Amber |
last post by:
Stored procedures are faster and more efficient than in-line SQL
statements. In this article we will look at two SQL Server stored
procedures; one using an input parameter and one not, and see how...
|
by: deepdata |
last post by:
Hi,
I am trying to fetch data from db2 (express version) database by
calling stored procedure. I have tried to use both cursor and for loop
but still i am getting error.
--======Start...
|
by: ILCSP |
last post by:
Hello, I'm trying to accomplish 3 things with one stored procedure.
I'm trying to search for a record in table X, use the outcome of that
search to insert another record in table Y and then exec...
|
by: acw |
last post by:
On a SQL Server 2000 db I would like to setup a stored procedure that
accesses couple tables and runs the extended stored procedure
xp..cmdshell. The goal is to grant users with limited privileges...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |