Author |
Topic |
michelle55
Starting Member
7 Posts |
Posted - 2011-04-12 : 17:31:23
|
Hi I am trying to do a Login stored procedure with using email address and password Would it be like this:create procedure [dbo].[Get_Customer_Login](@password nvarchar(255)@email nvarchar(255))as select * from tblCustomers$where Password = @passwordand emailaddr = @emailaddr |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
michelle55
Starting Member
7 Posts |
Posted - 2011-04-12 : 17:39:47
|
yes i'm trying to connect it to visual studio using the run procedure: Public Sub RunProcedure(ByVal strName As String) ' purpose: Runs any stored procedure that does NOT need parameters ' inputs: Name of stored procedure ' CREATES INSTANCES OF THE CONNECTION AND COMMAND OBJECT Dim objConnection As New SqlConnection(mstrConnection) ' Tell SQL server the name of the stored procedure you will be executing Dim objCommand As New SqlDataAdapter(strName, objConnection) Try ' SETS THE COMMAND TYPE TO "STORED PROCEDURE" objCommand.SelectCommand.CommandType = CommandType.StoredProcedure ' OPEN CONNECTION AND FILL DATASET objCommand.Fill(mDataset, "tblMovies") ' Me.mdbConn.Close() ' Me.mdbConn.Open() MyView.Table = Me.mDataset.Tables("tblMovies") Catch ex As Exception Throw New Exception("stored procedure is " & strName.ToString & " error is " & ex.Message) End Try End Suband then how would i connect that to the form where it has two textboxes one for email and password and then a login button? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
michelle55
Starting Member
7 Posts |
Posted - 2011-04-12 : 17:42:03
|
wait it's not working now in sql with those two email and password.. was the coding for them or should it be different |
|
|
michelle55
Starting Member
7 Posts |
Posted - 2011-04-12 : 17:47:30
|
create procedure [dbo].[Get_Customer_Login](@password nvarchar(255)@emailaddr nvarchar(255))as select * from tblCustomers$WHERE Emailaddr = @Emailaddr AND Password = @Password |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
michelle55
Starting Member
7 Posts |
Posted - 2011-04-12 : 18:16:49
|
so i am trying to do the login with password and email but i couldn't do it with both in one procedure in sql so now i am doing it in two Public Sub GetEmailAddress() RunProcedure("usp_Get_By_Email_Address") End Sub Public Sub GetCustomerPassword() RunProcedure("usp_Get_Customer_Password") End Sub Public Sub FilterViewByEmailAddress(ByVal strIN As String) MyView.RowFilter = "EmailAddr Like '" & strIN & "'" End Sub Public Sub FilterViewByCustomerPassword(ByVal strIN As String) MyView.RowFilter = "Password Like '" & strIN & "'" End Sub Public Sub FilterViewByBoth(ByVal EmailAddr As String, ByVal Password As String) MyView.RowFilter = "EmailAddr Like '" & EmailAddr & "' AND Password Like '" & Password & "'" End Subthat's what i have in my customerdatabaseclass and i want to refer it to the form now but in the filter() my coding is not connecting to the class i have: Public Sub Filter() Dim stremailadress As String = txtEmailAddress.Text Dim strpassword As String = txtPassword.Text If stremailadress <> "" And strpassword <> "" Then lblMessage.Text = "Please enter a valid login!" End If If DB.FilterViewByBoth(stremailadress, strpassword) Then lblMessage.Text = "Correct Login!" End If End Subbecause in the signin button ill only have filter there as coding |
|
|
michelle55
Starting Member
7 Posts |
Posted - 2011-04-12 : 18:18:15
|
this is how my form looks:Please Sign In or Create a Safari AccountEmail Address: Password: signinbutton [lblMessage] |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
michelle55
Starting Member
7 Posts |
Posted - 2011-04-12 : 18:21:57
|
okay i will thank you |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|