Displaying results in text box from a hyperlink coulm in datagrid

Discussion in 'ASP .Net Datagrid Control' started by Nithin, Jan 12, 2004.

  1. Nithin

    Nithin Guest

    HI,
    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
    http://localhost/myprojects/tasktra...icket_id=20001.

    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)

    Try
    MyConnection.Open()
    _reader = objCmd.ExecuteReader()
    If _reader.Read Then
    txtBsc.Text = "Bsc"
    End If
    _reader.Close()
    Catch ex As SqlException
    Response.Write(ex.ToString)
    MyConnection.Close()

    End Try
    End Sub

    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(CommandBehavior
    cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at
    System.Data.SqlClient.SqlCommand.ExecuteReader() at
    tasktracker.reportcal4_details.Page_Load(Object sender, EventArgs e)
    in C:\Inetpub\wwwroot\myprojects\tasktracker\reportca
    l4_details.aspx.vb:line 41
    Nithin, Jan 12, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Monique Y. Mudama
    Replies:
    1
    Views:
    444
    Monique Y. Mudama
    Jun 28, 2005
  2. Ezee
    Replies:
    1
    Views:
    644
    Andrew Thompson
    Aug 17, 2005
  3. Gnarlodious
    Replies:
    4
    Views:
    17,566
    elizas
    May 5, 2010
  4. davetichenor
    Replies:
    1
    Views:
    811
    Eliyahu Goldin
    Oct 30, 2006
  5. Dave
    Replies:
    0
    Views:
    928
Loading...

Share This Page