Stored Procedure Problem

L

Leon Shaw

I'm I Assign the value to the following store procedures correctly in
vs.net?
(The code is my only concern)
Me.cmdAddMember.Parameters("@Username").Value = Me.txtUsername.Text

Me.cmdAddMember.Parameters(2).Value = Me.txtPassword.Text

Me.cmdAddMember.Parameters(3).Value = Me.ddlSecretQuestion.SelectedItem

Me.cmdAddMember.Parameters(4).Value = Me.txtSecretAnswer.Text

Me.cmdAddMember.Parameters(5).Value = Me.txtFirstName.Text

Me.cmdAddMember.Parameters(6).Value = Me.txtLastName.Text

Me.cmdAddMember.Parameters(7).Value = Me.ddlBirthMonth.SelectedItem

Me.cmdAddMember.Parameters(8).Value = Me.ddlBirthDay.SelectedItem

Me.cmdAddMember.Parameters(9).Value = Me.txtBirthYear.Text

etc.
 
J

Jurjen de Groot

Leon,

You should always name the parameter, you only named the first (@Username)
the others you just assigned values. Why not try this, it's more readable
too !!

With Me.cmdAddMember
.Parameters.Add("@Username", Me.txtUsername.text)
.Parameters.Add("@Password", Me.txtPassword.text)
etc...
End With

Hope this helps.

Jurjen de Groot
G.I.T.S., Netherlands
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top