Click here to Skip to main content
15,889,863 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys, im just a newbie here. My question is simple, how to view 1 record form a database using a textbox. Example, if my textbox contains userid then i want my other textboxes contain the other data
EX:
(i dont know if it is correct but in VB6 here is the code)
if txtuser.text = !UserID then
!Password = txtpassword.text
!Location = txtlocation.text
etc.
I dont know how is the syntax in asp.net and when I search on google, only gridview is shown.

Plss help me.. Thanks in advance and more power..
Posted

"I don't know how is the syntax in ASP.NET and when I search on Google, only GridView is shown."
This is not true: "only GridView is shown". Don't fool yourself.

—SA
 
Share this answer
 
Sir I have here my code but where will i put the textboxes. This code dont have error so i dont know whats the problem
<pre lang="vb">Dim username As String = Session("Username")
      lblUser.Text = username
  Dim connection As SqlClient.SqlConnection = New SqlClient.SqlConnection("Data Source=ML0003135586;Integrated Security=SSPI;" & "Initial Catalog=TestSQL")
  Dim search As String
  search = "Select * from [LogMe] WHERE([User_ID] = @ID)"
  connection.Open()
  Dim command As New SqlClient.SqlCommand(search,connection)
  command.Parameters.AddWithValue("@ID", lblUser.Text)
Dim DataReader As SqlClient.SqlDataReader = command.ExecuteReader()
Do While DataReader.Read()
  Console.WriteLine(DataReader("Name").ToString)
  Console.WriteLine(DataReader("Cost_Center").ToString)
  Console.WriteLine(DataReader("Role_ID").ToString)
Loop

command.Dispose
connection.Close()


 
Share this answer
 
Comments
Baji Jabbar 2-May-11 5:59am    
Hey you have the solution here itself
Instead of Console.WriteLine use
TextBox_Whatever.Text=DataReader("Whatever").ToString()

Then how this Console.WriteLine came to your ASP.Net project

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900