Click here to Skip to main content
15,899,313 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Retrieving data in selected row of datagrid Pin
nlarson1116-Jul-07 7:56
nlarson1116-Jul-07 7:56 
GeneralRe: Retrieving data in selected row of datagrid Pin
Cory Kimble28-Aug-07 6:29
Cory Kimble28-Aug-07 6:29 
QuestionTwo problems with a thread project Pin
Zero-G.11-Jul-07 4:29
Zero-G.11-Jul-07 4:29 
AnswerRe: Two problems with a thread project Pin
Colin Angus Mackay11-Jul-07 5:30
Colin Angus Mackay11-Jul-07 5:30 
GeneralRe: Two problems with a thread project Pin
Paul Conrad11-Jul-07 7:18
professionalPaul Conrad11-Jul-07 7:18 
AnswerRe: Two problems with a thread project [modified] Pin
TwoFaced11-Jul-07 8:23
TwoFaced11-Jul-07 8:23 
GeneralRe: Two problems with a thread project Pin
Zero-G.11-Jul-07 20:23
Zero-G.11-Jul-07 20:23 
Questionhash Pin
boyindie11-Jul-07 4:25
boyindie11-Jul-07 4:25 
Hi
I have been playing around with a password hashing scheme for my application

But i keep getting an error message when it executes the command object

i get the error

Unable to cast object of type 'System.byte[]' to type 'system.inconvertible'

Any suggestions?

Sub CreateAccount(ByVal sender As Object, ByVal e As EventArgs)
Dim literror As New LiteralControl
'1. Create a connection
'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)
Try
'2. Create a command object for the query
Dim strSQL As String = _
"INSERT INTO Useraccount(Username,Password) " & _
"VALUES(?Username, ?Password)"
Dim objCmd As New MySqlCommand(strSQL, connection)

'3. Create parameters
Dim paramUsername As MySqlParameter
paramUsername = New MySqlParameter("?Username", SqlDbType.VarChar, 25)
paramUsername.Value = txtUsername.Text
objCmd.Parameters.Add(paramUsername)


'Encrypt the password
Dim md5Hasher As New MD5CryptoServiceProvider()

Dim hashedBytes As Byte()
Dim encoder As New UTF8Encoding()

hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(txtPwd.Text))

Dim paramPwd As MySqlParameter
paramPwd = New MySqlParameter("?Password", SqlDbType.Binary, 16)
paramPwd.Value = hashedBytes
objCmd.Parameters.Add(paramPwd)


'Insert the records into the database
connection.Open()
objCmd.ExecuteReader()
connection.Close()
Catch ex As Exception
literror.Text = ex.Message
MsgBox(ex.Message)

End Try
Response.Redirect("userhome.aspx")

End Sub
AnswerRe: hash Pin
Dave Kreskowiak11-Jul-07 6:02
mveDave Kreskowiak11-Jul-07 6:02 
GeneralRe: hash Pin
Paul Conrad11-Jul-07 7:02
professionalPaul Conrad11-Jul-07 7:02 
QuestionVideo Player with different formats Pin
Zero-G.11-Jul-07 4:22
Zero-G.11-Jul-07 4:22 
AnswerRe: Video Player with different formats Pin
Dave Kreskowiak11-Jul-07 5:59
mveDave Kreskowiak11-Jul-07 5:59 
GeneralRe: Video Player with different formats Pin
Zero-G.11-Jul-07 20:26
Zero-G.11-Jul-07 20:26 
GeneralRe: Video Player with different formats Pin
Dave Kreskowiak12-Jul-07 1:40
mveDave Kreskowiak12-Jul-07 1:40 
QuestionHaving trouble updating form Pin
Cory Kimble11-Jul-07 4:09
Cory Kimble11-Jul-07 4:09 
AnswerRe: Having trouble updating form Pin
Luc Pattyn11-Jul-07 5:32
sitebuilderLuc Pattyn11-Jul-07 5:32 
QuestionDatagridview column header color Pin
chakor12311-Jul-07 2:57
chakor12311-Jul-07 2:57 
AnswerRe: Datagridview column header color Pin
Rupesh Kumar Swami11-Jul-07 4:30
Rupesh Kumar Swami11-Jul-07 4:30 
QuestionCalling form of vb.net fom vb6.0 application Pin
ShuklaGirish11-Jul-07 1:46
ShuklaGirish11-Jul-07 1:46 
AnswerRe: Calling form of vb.net fom vb6.0 application Pin
Christian Graus11-Jul-07 2:09
protectorChristian Graus11-Jul-07 2:09 
GeneralRe: Calling form of vb.net fom vb6.0 application Pin
ShuklaGirish11-Jul-07 2:46
ShuklaGirish11-Jul-07 2:46 
GeneralRe: Calling form of vb.net fom vb6.0 application Pin
originSH11-Jul-07 3:17
originSH11-Jul-07 3:17 
Questionplease help me...its about vb.net Pin
Rharzkie11-Jul-07 1:41
Rharzkie11-Jul-07 1:41 
AnswerRe: please help me...its about vb.net Pin
Christian Graus11-Jul-07 2:10
protectorChristian Graus11-Jul-07 2:10 
GeneralRe: please help me...its about vb.net Pin
Rharzkie11-Jul-07 2:25
Rharzkie11-Jul-07 2:25 

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.