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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Feel Like an idiot!

Status
Not open for further replies.
May 10, 2002
77
US
I have been through so many different sites and asp.net books and still just cannot get this to work and feel like an idiot! What I have is a form where the user enters two fields. I need to take these two fields plus four more and display the information to the screen and also write it to another database to keep up with what the users are doing. I've been working on this gotta be simple step forever! I haven't even tried writting it to the other DB yet, just to display the information. Here's the last bit of code I have tried: (form and display items are currently separate pages):


DIM cmdSelectStudent As SqlCommand
DIM dtrStudents As SqlDataReader
cmdSelectStudent = New SqlCommand ("Select cpsstatus, lastname, firstname, ssn from @table where ssn=@ssn")
dtrStudents = cmdSelectStudent.ExecuteReader()
While dtrStudents.Read()
Response.Write(dtrStudents("lastname", "firstname", "@ssn", "cpsstatus" ))
End While
dtrStudents.Close()
conDB.Close()

This was the last one I have tried which is completely different than the other ways (which I do not have).

Please help...
 
Instead of Response.Write(), you could create dynamic controls, such as the Label Controls.

Start in your form designer by dragging a PlaceHolder control to where you want the data displayed.

Then in your code-behind, query the database, collection the data from the DataReader, and then create new Labels.

Add the labels you create to the PlaceHolder.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
If you are going to use the solution by googler, you will also have to remember to add a runat="server" tag to the div/span.

Personally, I would go with a Label (or even a LiteralControl) like tgreer suggests.

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
I would not go with my solution either =), if you are going to use .net you should use it's tools to take advantage and not try to replicate what you can do with ASP
 
For anyone who reads this later on, the <asp:Label... /> worked like a charm! Thanks!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top