r/ASPNET • u/InneractWithTunes • Jul 30 '13
Help with asp.net login page in vb
I'm trying to build a simple login page, but keep running into trouble. Here's the stackoverflow post i made
Anyone know what's wrong?
2
Upvotes
2
u/InneractWithTunes Jul 30 '13
Thanks guys. I got fed up last night and ended up doing one of the tutorials on Microsoft's site for a simple login page. Just deleted all the css and styled it myself.
3
u/legendaris Jul 30 '13
I am not too familiar with VB or .aspx files. (Coding with ASP.net MVC on razer engine) but I'm pretty sure you shouldn't put code into the .aspx file. Especially SQL commands.
I know you're probably just learning, but might as well learn it the right way to begin with.
1
u/wundie Jul 30 '13
I only use parameters when doing a stored procedure...so your usage may be wrong. Anyhow, for your inline sql just do:
Dim cmd As New SqlCommand(String.Format("select * from users where UserName ={0} and Password={1}",txtUserName.Text,txtPWD.Text), con)
and delete the cmd.Parameters.AddWithValue all together.
1
u/[deleted] Jul 30 '13
Recreate the page and use codebehind.