Displaying results in text box from a hyperlink coulm in datagrid
I have a datagrid that displays records. I have a hyperlink column
with a link to another page called "reportcal_details.aspx". Users can
go to the details page where they see all their information in text
box fields and update information.
My datagrid and hyperlink column works fine and I am able to send the
value of the "Ticket_id" (primary key) to the next page with the query
string in the URL
I am even able to print this Ticket_id on my reportcal_details.aspx
page. But, I am unable to display the values for that Ticket_id inside
a text box that the users can update.
Here is the code for the details page. I have included just one text
box to make it easier.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim _reader As SqlDataReader
Dim strTicketId As String = Request.QueryString("Ticket_id")
Response.Write("The Ticket ID is " + strTicketId + "<br>")
Dim strSQL2 As String = "SELECT Bsc" & _
"FROM Tracker2" & _
"WHERE Ticket_id= '" & strTicketId & "'"
Dim objCmd As New SqlCommand(strSQL2, MyConnection)
_reader = objCmd.ExecuteReader()
If _reader.Read Then
txtBsc.Text = "Bsc"
Catch ex As SqlException
Here is how my ERROR page appears:
The Ticket ID is 20001
System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near
'Ticket_id'. at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at
tasktracker.reportcal4_details.Page_Load(Object sender, EventArgs e)
|All times are GMT. The time now is 01:17 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.