Click here to Skip to main content
15,922,155 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionToggle Button in ToolStrip Pin
MadmanWoo12-Jul-07 13:13
MadmanWoo12-Jul-07 13:13 
AnswerRe: Toggle Button in ToolStrip Pin
Paul Conrad13-Jul-07 12:25
professionalPaul Conrad13-Jul-07 12:25 
Questionforce a right click Pin
Cory Kimble12-Jul-07 10:58
Cory Kimble12-Jul-07 10:58 
AnswerRe: force a right click Pin
cutequencher12-Jul-07 16:53
cutequencher12-Jul-07 16:53 
AnswerRe: force a right click Pin
Dave Kreskowiak13-Jul-07 2:35
mveDave Kreskowiak13-Jul-07 2:35 
GeneralRe: force a right click Pin
Cory Kimble13-Jul-07 3:14
Cory Kimble13-Jul-07 3:14 
GeneralRe: force a right click Pin
Dave Kreskowiak13-Jul-07 15:32
mveDave Kreskowiak13-Jul-07 15:32 
Questionweird problem Pin
boyindie12-Jul-07 8:08
boyindie12-Jul-07 8:08 
Hi
I have created a create user login function

which creates a random salt for each individual user and stores it into my mySQL database along with a salted hashed password

I enter all the data into my database thru a stored procedure

i keep on getting an odd error

That my procedure expected 7 parameters and only received 6

Altho my code is definetly passing 7 parameters accross to the database, on debuggin the parameter count is also equal to 7, it doesn't make sense, probably somthin stupid

can anyone see the problem



Cheers
Boy

my procedure is
CREATE DEFINER=`jshort`@`localhost` PROCEDURE `sp_myinsertUsers`(IN p_userName varchar(20), IN p_password varchar(200),IN p_salt varchar(200),IN p_firstName varchar(20), IN p_lastname varchar(200),IN p_phone integer(12), IN p_mail varchar(200))
BEGIN
INSERT INTO users(userName,Password,salt,user_firstName, user_lastName, user_phone,user_mail)VALUES(p_username, p_password,p_salt, p_firstname, p_lastname, p_phone, p_mail)
;
END


my code is as follows

Sub send_loginCreds(ByVal sender As Object, ByVal e As EventArgs)
Dim litErr As New LiteralControl
Dim shaHash As New System.Security.Cryptography.SHA384Managed()


Dim hashedBytes As Byte()

Dim encoder As New UTF8Encoding()

Dim data() As Byte
data = New Byte(6) {}
Dim rng As New RNGCryptoServiceProvider
rng.GetBytes(data)

Dim PSalt As String = Convert.ToBase64String(data)


'Create connection string to pass database, string holds login information to mySQL,
Dim connectionString As String
connectionString = "Server=localhost; ;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_myInsertusers"
'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 = txtFirstName.Text


'encrypt(password)
hashedBytes = shaHash.ComputeHash(encoder.GetBytes(txtPassword.Text))
Dim PWhash As String = encoder.GetString(hashedBytes)
param = cmdString.Parameters.Add("?p_Password", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = PWhash

param = cmdString.Parameters.Add("?p_salt", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = PSalt



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

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

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

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


'Insert the records into the database
connection.Open()
cmdString.ExecuteNonQuery()
connection.Close()

Catch ex As Exception
litErr.Text = ex.Message
MsgBox(ex.Message)

End Try

Server.Transfer("userhome.aspx")



End Sub
AnswerRe: weird problem Pin
Paul Conrad12-Jul-07 8:36
professionalPaul Conrad12-Jul-07 8:36 
GeneralRe: weird problem Pin
boyindie12-Jul-07 8:41
boyindie12-Jul-07 8:41 
GeneralRe: weird problem Pin
Paul Conrad12-Jul-07 8:48
professionalPaul Conrad12-Jul-07 8:48 
GeneralRe: weird problem Pin
Dave Kreskowiak12-Jul-07 8:53
mveDave Kreskowiak12-Jul-07 8:53 
GeneralRe: weird problem Pin
boyindie12-Jul-07 8:56
boyindie12-Jul-07 8:56 
GeneralRe: weird problem Pin
Paul Conrad12-Jul-07 9:00
professionalPaul Conrad12-Jul-07 9:00 
GeneralRe: weird problem Pin
boyindie12-Jul-07 9:01
boyindie12-Jul-07 9:01 
GeneralRe: weird problem Pin
Paul Conrad12-Jul-07 9:15
professionalPaul Conrad12-Jul-07 9:15 
QuestionHow to handle empty text boxes Pin
mymacryan12-Jul-07 7:48
mymacryan12-Jul-07 7:48 
AnswerRe: How to handle empty text boxes Pin
nlarson1112-Jul-07 7:51
nlarson1112-Jul-07 7:51 
GeneralRe: How to handle empty text boxes Pin
nlarson1112-Jul-07 8:02
nlarson1112-Jul-07 8:02 
AnswerRe: How to handle empty text boxes Pin
Christian Graus12-Jul-07 8:04
protectorChristian Graus12-Jul-07 8:04 
GeneralRe: How to handle empty text boxes Pin
nlarson1112-Jul-07 8:14
nlarson1112-Jul-07 8:14 
AnswerRe: How to handle empty text boxes Pin
The ANZAC12-Jul-07 12:58
The ANZAC12-Jul-07 12:58 
QuestionBackgroundWorker help Pin
Paul .12-Jul-07 7:32
Paul .12-Jul-07 7:32 
AnswerRe: BackgroundWorker help Pin
nlarson1112-Jul-07 7:53
nlarson1112-Jul-07 7:53 
GeneralRe: BackgroundWorker help Pin
Paul .12-Jul-07 8:02
Paul .12-Jul-07 8:02 

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.