Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use loginName control in SQL statement 1

Status
Not open for further replies.

TheViper

Technical User
Mar 16, 2001
14
CA
I have set up a simple website with VWD2008 and everything works correclty - I can display and edit data from the database, login correclty and administer the website remotely.

The only issue I am facing is I want to use the output of the LoginName control in a SQL select statement so I can filter the data I show by username - e.g. Select * from example.table where UserName= LoginName1. Obviously this syntax won't work and from what I have been able to find on the Internet I will have to declare LoginName1 somehow so the SQLDataSource knows how to use it. Can any one help?

The problem is that I am new to SQL and ASP.NEt and the posts I have found are aimed at a level higher than I am at. I need someone to hold my hand a bit and explain where I need to place code and how I should syntax my queries etc. Any help would be greatly appreciated.

Thanks...
 
Do not use the DataSource controls.

Once the user has logged in successfully, store the username in a session variable. Then you can use that value in your SQL statement anywhere throughout the application.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top