|
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
|
|
|
|
|
The code seems seasonable to me, other than you might want to pick a stronger encryption (MD5 is known to be very weak!), and possibly check that the number of bytes comming from the hash will actually fit in the database field and the field is of the correct type to hold the data.
I don't use MySQL, so I don't know what it's going to support and what it's not, or what it's requirements for field types are going to be.
|
|
|
|
|
Dave Kreskowiak wrote: MD5 is known to be very weak!
Yep. Even my coffee is stronger :->
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hey NG
I am looking for a Video Player, which can play different types of Video Format.
For example: mpg, vob, divx, Flash, PowerPoint and so on.
Does anybody know, where I can get something like that, or how to make such a player?
I am using VB2005
Yours faithfully - THX
|
|
|
|
|
There is no player that can play all those formats. Most of the video formats require that codecs be installed, like vob and divx, in order for any player to play them. I don't know of any player that can play ShockWave/Flash AND PowerPoint AND any video stream.
Making a player like this yourself would require a enormous amount of work on your part and a complete understanding of each file format you want to support, like Flash or PowerPoint, and how to parse and render them.
|
|
|
|
|
Hey
Thank you, for reply. - This did not sound good....
Maybe out there someone had the idea to make such a player.
I will look further for informations.
Thank you!
|
|
|
|
|
|
I have a form with a DataGrid and a Listbox. My goal is to do a if statement looking for setting and depending on the outcome, show either the Data Grid OR the listbox by using the visible parameter. When I load the form it correctly shows the correct control by loading a saved file with the setting. I call a method in the same class and pass the value. The problem comes when I use a different form (Different class) and try to pass the setting in again. EX: I want to go to a properties windo and change the settings and have it update the baseform. I see the values going in the method but I don't see the form changing.
Code.
Private Sub frminYardTrucks_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
FileOpen(1, "C:\properties.txt", OpenMode.Input, OpenAccess.Read, OpenShare.LockRead)<br />
<br />
Dim savedProperties As Properties<br />
<br />
Input(1, savedProperties.software<br />
<br />
testSoftwareProperties(savedProperties.software)<br />
<br />
Public Sub testSoftwareProperties(ByVal choice As String)<br />
If choice.Equals("Transact") Then<br />
'MessageBox.Show("Show Grid")Test<br />
Me.lstbxTrucks.Visible = False<br />
Me.TestDataGrid.Visible = True<br />
<br />
Else<br />
'MessageBox.Show("Show Listbox")Test<br />
Me.TestDataGrid.Visible = False<br />
Me.lstbxTrucks.Visible = True<br />
End If<br />
End Sub<br />
<br />
Public Class frmProperties<br />
Inherits Windows.Forms.Form<br />
'Read in file and saved to cmbobxSoftware.Text <br />
Public Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click<br />
Dim test As New frminYardTrucks<br />
test.testSoftwareProperties(cmbobxSoftware.Text.ToString)
When I complete btnSave_Click the frm does not change.
Does it have to deal with Overriding.
|
|
|
|
|
You are missing an essential point (and if IIRC you did the same in some earlier post):
when you have a specialized form class (such as frminYardTrucks) you
dont have any object yet, and you dont see anything yet.
when you instantiate this class (with the New keyword), you have a form, that you dont
see yet, until you call Show (or ShowDialog) on it.
when you instantiate this class again, you get a second form, that you again dont see
until you Show it...
So creating a second form, not showing it and modifying it will never help you:
the original, unmodified form will be visible, the second modified form remains invisible.
What you must do is modify your EXISTING form instance, so dont do New frminYardTrucks
more than once, if you only want a single frminYardTrucks !!!
|
|
|
|
|
I want to change the vb.net datagridview control's color. the column headers are always displayed in Gray by default. does anyone know which property should i use to change this color. there are some properties which set the datagridview's cell's color. but i want a property which will change the column header color.
Thanks!
|
|
|
|
|
hi,
change datagridview property "EnableHeaderVisualStyles" to false & after that from "columnheaderdefaultcellstyle" property you can change the color of header
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
hi,
I want to know how i can Call form created in vb.net fom vb6.0 application.
Can someone send me some links or code to do this.
Thanks and Regards,
GIRISH
|
|
|
|
|
You can't interact with VB.NET from VB6, you can start a VB.NET program, just like any other.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I have got something called as InterOp but i am not able to understand the logic correctly,it has demo also which shows that it it possible to call vb.net from from vb6.0 application.So,pls If u know the answer then give the answer and if u dont know the answer then dont give it atleast dont say that it is not possible.
|
|
|
|
|
|
I am a student, and we have a project about making a computerized system.
I am making the data entry module of the grades per class. How can view in the datagrid all of the students who enrolled in that class.
I hope you understand me...
please reply as soon as possible.
|
|
|
|
|
Rharzkie wrote: please help me...its about vb.net
Really ? Here in the VB.NET forum ? Seriously, try putting a meaningful subject line.
Rharzkie wrote: How can view in the datagrid all of the students who enrolled in that class.
By doing a SQL call to get that data, and putting it in a control like a gridview. What is your data store ?
Rharzkie wrote: please reply as soon as possible.
See, that's just rude.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
ok, sorry, its my first time here...
i just made database in access, the database is composed of different tables: file maintenance of the students, then the different subjects...
how to do an sql call to get the data???
in my module, the user will need to click the search button to search for the the different subjects. then, if you click it, all of the students who enrolled in that subjects will be view in the datagrid...
how can i do it?? i made a separate database for that. I think, i need to make a query for that, but i dont know how.
|
|
|
|
|
There are classes built into .NET for database access, there's tons of info on the web, google 'VB.NET Access database'. If you don't know how to write the SQL, then you need to buy a book and work through it, you're after the most simple SQL line there is.
Rharzkie wrote: I think, i need to make a query for that, but i dont know how.
Yes, you need to take the string and pass it to a query that searches for it. Again, you're asking very much beginner SQL questions, you need to buy a book and learn from it, so you have some understanding of what you're trying to do.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
i just wanna ask again, about what i posted last night... I made a 3 database in access, then how can I connect those 3 database to each other.
I'd use the OleDbDataAdapter. In the data adapter configuration wizard, in the query builder, will i choose those 3 database so that it will be connected?
|
|
|
|
|
As already stated, it's important to read the forum guidelines. We have had a ton of 'bad posts' lately. Some of the highlights:
1. Don't use words like 'need help' or 'urgent' in your message titles. Give them meaningful titles like 'having trouble connecting to DB' or whatever.
2. It makes it easier for us to help you if you post some of your code so we can see what you have, where you are going wrong/right, etc.
______________________
stuff + cats = awesome
|
|
|
|
|
Hi,
I have a schema which reflects a table in the database.
I've just added a field to the schema table, called Watermark.
I've built the library.
But when I access it in my main project, the intellisense works:
reportSchema.Dataset.tblReport(recordnum).Watermark
But at runtime, I get an error:
Watermark is not a member of tblReportRow
I've tried removing and readding it a few times.
Its like the autogen code in vs2005 hasnt updated everything.
Anyone seen this before?
|
|
|
|
|
Mark06 wrote: I've just added a field to the schema table, called Watermark.
Did you just add this field to the database only?? The designer will not know this happened and hence, won't regenerate the code you're talking about. You either have to scrap your existing dataset and drag the table to the desginer again, or you have to modify the designer generated code by hand to add this field and all the support for it.
|
|
|
|
|
is there any program that finalize the application of vb2005 in order to launch in any computer ?
as setup factory !
urgent
|
|
|
|