I have login in my asp page req name/pass and button.
I create the connecttion string to my database and SqlDataSource with the query well here in the SqlDataSource:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:CarRentalConnectionString %>"
SelectCommand="SELECT * FROM [Customers] WHERE (([UserName] = @UserName) AND ([PassWord] = @PassWord))">
<SelectParameters>
<asp:ControlParameter ControlID="uname" Name="UserName" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="pass" Name="PassWord" PropertyName="Text" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
My problem is I don’t know how to active/execute it and how do I get the data that is returned from the query?
I have a feeling am going at this the wrong way (hope am wrong)
Hope one of you can give me a tip or point me in the right direction 🙂
Thanks in advance
Using SqlDataSource is inappropriate as you’re not simply retrieving data in a declaritive way. You’ll want to define user verification (not validation) logic procedurally.
The usual approach follows. Note that you should hash your passwords rather than storing them in plaintext. Hash salting has been omited for brevity.