Skip to main content
April 1, 2009
Question

asp.net populate dropdown problem

  • April 1, 2009
  • 1 reply
  • 337 views
Hello,

I am having difficulty in trying to populate a dropdown, I can do this fine untill i add WHERE to the statement.

I have created a page where the user logs in and the username is then displayed in a text field called 'user' - i want the sql statement to do this:

SELECT regnumber
FROM regdetails
WHERE username = user

If i substitute the user for the actual user for eg
WHERE username = 'Peter'
then it works fine

i have tried using Dreamweaver dataset complier but can not get it to work. (also its in C#)

Hope somebody can help or advise

many thanks

Lance
This topic has been closed for replies.

1 reply

Inspiring
April 6, 2009

Lance,

  Can you provide me with the page error?  Also some of your C# code, I might be able to help. How are you binding the dropdown box or textbox?

If you are using a sqldatasource control you can binding the textbox with the username:
<asp:TextBox ID="user" runat="server"   Text='<%# Bind("username") %>' />

David Pearson

www.saludalabs.com

www.workhorsecreative.net