Click here to Skip to main content
15,902,817 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionasp.net database Pin
mrwatson5410-Jul-07 11:25
mrwatson5410-Jul-07 11:25 
AnswerRe: asp.net database Pin
Michael Sync10-Jul-07 19:50
Michael Sync10-Jul-07 19:50 
GeneralRe: asp.net database Pin
mrwatson5410-Jul-07 22:34
mrwatson5410-Jul-07 22:34 
GeneralRe: asp.net database Pin
Michael Sync10-Jul-07 22:46
Michael Sync10-Jul-07 22:46 
Questionset an id of my website Pin
miss khawaja10-Jul-07 9:34
miss khawaja10-Jul-07 9:34 
AnswerRe: set an id of my website Pin
eggsovereasy10-Jul-07 11:05
eggsovereasy10-Jul-07 11:05 
AnswerRe: set an id of my website Pin
Michael Sync10-Jul-07 19:45
Michael Sync10-Jul-07 19:45 
Questionreturn value from stored procedure problem Pin
boyindie10-Jul-07 9:22
boyindie10-Jul-07 9:22 
Hi
I have writing the following login screen in asp.net which uses an stored procedure, which if the login credentials equal whats returned from the select statement it should return a 1

I am having problems getting my asp page to grab the value which is returned from the stored procedure

for some reason this code sets the return value to 6, wether its right or wrong!

here is my stored procedure code
CREATE DEFINER=`jshort`@`localhost` PROCEDURE `sp_userlogin`(IN p_UserName VARCHAR(50), IN p_Password VARCHAR(50))
BEGIN
IF EXISTS(SELECT * FROM Users WHERE UserName = p_UserName AND PASSWORD = p_Password) THEN
SELECT 1;
ELSE
SELECT 0;
END IF;
END

and my code for the asp page is as follows

Sub sendData(ByVal sender As Object, ByVal e As EventArgs)
Dim litErr As New LiteralControl


'Create connection string to pass database, string holds login information to mySQL,
Dim connectionString As String
connectionString = "Server=localhost; uid=; pwd=;database=ftp1;"

'Builds .net mysql connection and passes connection string into method
Dim connection As New MySqlConnection(connectionString)



'Create mySql command string for passing query or SPROC(Stored Procedure)
Dim cmdString As New MySqlCommand
'Set Command to equal mySql connection,t so can pass SQL query
cmdString.Connection = connection

Try
'Set command string to equal SPROC
cmdString.CommandText = "sp_userlogin"
'ONLY PLACE THIS IF SPROC, sets the command to a SPROC
cmdString.CommandType = CommandType.StoredProcedure

Dim param As New MySqlParameter






param = cmdString.Parameters.Add("?p_username", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = txtUserName.Text

param = cmdString.Parameters.Add("?p_password", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = txtPassword.Text

param = cmdString.Parameters.Add("return", MySqlDbType.Int32)
param.Direction = ParameterDirection.Input
param.Value = ParameterDirection.ReturnValue


'Executes stored procedure
connection.Open()
cmdString.ExecuteNonQuery()
connection.Close()


Catch ex As Exception
'Returns error message
litErr.Text = ex.Message
MsgBox(ex.Message)

End Try


Dim validation As Object = cmdString.Parameters("return").Value

If validation = 0 Then
MsgBox("user login not valid")
Else
Response.Redirect("userhome.aspx")
End If

AnswerRe: return value from stored procedure problem Pin
Guffa10-Jul-07 9:54
Guffa10-Jul-07 9:54 
QuestionDatalist control Pin
DonVBguy10-Jul-07 9:08
DonVBguy10-Jul-07 9:08 
QuestionCheckAll/Uncheck all Pin
kibromg10-Jul-07 7:59
kibromg10-Jul-07 7:59 
AnswerRe: CheckAll/Uncheck all Pin
sam#10-Jul-07 8:36
sam#10-Jul-07 8:36 
AnswerRe: CheckAll/Uncheck all Pin
sidbaruah10-Jul-07 19:30
sidbaruah10-Jul-07 19:30 
GeneralRe: CheckAll/Uncheck all Pin
kibromg10-Jul-07 23:36
kibromg10-Jul-07 23:36 
GeneralRe: CheckAll/Uncheck all Pin
sidbaruah10-Jul-07 23:43
sidbaruah10-Jul-07 23:43 
GeneralRe: CheckAll/Uncheck all Pin
kibromg11-Jul-07 0:09
kibromg11-Jul-07 0:09 
QuestionEnable and Disable ActiveX Objects using Javascript Pin
Blue_Boy10-Jul-07 6:11
Blue_Boy10-Jul-07 6:11 
AnswerRe: Enable and Disable ActiveX Objects using Javascript Pin
Christian Graus10-Jul-07 7:18
protectorChristian Graus10-Jul-07 7:18 
Questionusing QueryString with dataList problem Pin
Amr M. K.10-Jul-07 5:56
Amr M. K.10-Jul-07 5:56 
AnswerRe: using QueryString with dataList problem Pin
Christian Graus10-Jul-07 7:20
protectorChristian Graus10-Jul-07 7:20 
QuestionReading values from dynamically added controls. Pin
dekart_roo10-Jul-07 5:43
dekart_roo10-Jul-07 5:43 
AnswerI fixed it? Pin
dekart_roo10-Jul-07 6:09
dekart_roo10-Jul-07 6:09 
QuestionIncludes in ASP.net (C#) Pin
totocaster10-Jul-07 5:42
totocaster10-Jul-07 5:42 
AnswerRe: Includes in ASP.net (C#) Pin
jcdevnet10-Jul-07 5:52
jcdevnet10-Jul-07 5:52 
GeneralRe: Includes in ASP.net (C#) Pin
totocaster10-Jul-07 6:09
totocaster10-Jul-07 6:09 

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.