| | |
displaying data from database to textbox
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2007
Posts: 66
Reputation:
Solved Threads: 0
Hello everyone,
I am working on a web using ASP.Net (VB) and Sybase as its back end. I am trying to display data from database to the textbox. Does anyone know, pls help.
Here's my code and its not working. pls. pls help. thanks a lot
Try
conn.Open()
cmd = New AseCommand("select Name from employee where Id = 12", conn)
reader = cmd.ExecuteReader()
If reader.Item("Name") = txtUserName.Text Then
txtPwd.Text = reader.Item("Name")
Else
txtPwd.Text = "No Match Data"
End If
Catch ex As AseException
Finally
If Not (reader Is Nothing) AndAlso Not (reader.IsClosed) Then
reader.Close()
End If
If Not (cmd Is Nothing) Then
cmd.Dispose()
End If
If Not (conn Is Nothing) Then ' AndAlso (conn.State <> ConnectionState.Closed) Then
conn.Close()
End If
End Try
I am not familiar with ASP.net. If you can modify especially in this part
If reader.Item("Name") = txtUserName.Text Then
txtPwd.Text = reader.Item("Name")
Else
txtPwd.Text = "No Match Data"
End If
it would be a great help. I know the error is in this part but I don't know what keyword or function i am going to use. Thanks a lot
I am working on a web using ASP.Net (VB) and Sybase as its back end. I am trying to display data from database to the textbox. Does anyone know, pls help.
Here's my code and its not working. pls. pls help. thanks a lot
Try
conn.Open()
cmd = New AseCommand("select Name from employee where Id = 12", conn)
reader = cmd.ExecuteReader()
If reader.Item("Name") = txtUserName.Text Then
txtPwd.Text = reader.Item("Name")
Else
txtPwd.Text = "No Match Data"
End If
Catch ex As AseException
Finally
If Not (reader Is Nothing) AndAlso Not (reader.IsClosed) Then
reader.Close()
End If
If Not (cmd Is Nothing) Then
cmd.Dispose()
End If
If Not (conn Is Nothing) Then ' AndAlso (conn.State <> ConnectionState.Closed) Then
conn.Close()
End If
End Try
I am not familiar with ASP.net. If you can modify especially in this part
If reader.Item("Name") = txtUserName.Text Then
txtPwd.Text = reader.Item("Name")
Else
txtPwd.Text = "No Match Data"
End If
it would be a great help. I know the error is in this part but I don't know what keyword or function i am going to use. Thanks a lot
Last edited by dudegio; Oct 5th, 2008 at 8:29 am.
•
•
Join Date: May 2007
Posts: 66
Reputation:
Solved Threads: 0
Hey Guys,
At last i found an unsolved article that uses the .Read function in reading data from database.
Below is my solution.
conn.Open()
cmd = New AseCommand("select * from employee where Id = " & txtUserName.Text, conn)
reader = cmd.ExecuteReader()
reader.Read()
If reader("Id") = txtUserName.Text Then
txtPwd.Text = reader("Name")
End If
At last i found an unsolved article that uses the .Read function in reading data from database.
Below is my solution.

conn.Open()
cmd = New AseCommand("select * from employee where Id = " & txtUserName.Text, conn)
reader = cmd.ExecuteReader()
reader.Read()
If reader("Id") = txtUserName.Text Then
txtPwd.Text = reader("Name")
End If
![]() |
Similar Threads
- displaying the last insert id (ASP.NET)
- Connectivity of SQL 2000 + VB using ODBC (Visual Basic 4 / 5 / 6)
- how can i display data in textbox from choosen dropdown menu? (VB.NET)
- Updating a record in an MS Access database file using DataSets (VB.NET)
- Login and retrieve user data from database (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: Newbie Having Trouble
- Next Thread: gridview+javascript
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax asp asp.net bc30451 beginner bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn cac checkbox child class click commonfunctions compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock deployment development dgv dialog dropdownmenu dynamic edit embeddingactivexcontrol expose feedback findcontrol flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery list menu mono mssql multistepregistration nameisnotdeclared novell objects order problem ratings rotatepage save search security serializesmo.table silverlight smartcard sql sqlserver2005 ssl suse textbox tracking treeview typeof unauthorized validation vb.net video virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment wizard xml youareanotmemberofthedebuggerusers





