SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2006
    Location
    Toronto
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with QueryStrings

    I am creating an "Update Record" form and I ran into a problem with QueryStrings! Please help!!!

    This is my code that gets the query string and I highlighted the line that causes the error:

    protected sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

    if Page.IsPostBack = false Then

    Dim eventName As String = Request.QueryString("event_name")
    eventName = REPLACE(eventName,"%20"," ")

    dim conn
    conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open(Server.Mappath("db/events.mdb"))
    dim rs
    rs = Server.CreateObject("ADODB.recordset")

    rs.Open ("SELECT * FROM events WHERE eventName = '" & eventName & "' ", conn)
    do until rs.EOF
    dim x
    for each x in rs.Fields
    if x.name = "eventName" then
    eventName.Text = x.Value end if
    next
    rs.MoveNext
    loop
    rs.Close
    conn.close

    End if
    end sub


    And this is the error message I am getting:
    Compiler Error Message: BC30456: 'Text' is not a member of 'String'.

  2. #2
    SitePoint Member idealviews.com's Avatar
    Join Date
    Jan 2007
    Location
    India
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Try this!

    protected sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

    if Page.IsPostBack = false Then

    Dim eventName As String = Request.QueryString("event_name")
    eventName = REPLACE(eventName,"%20"," ")

    dim conn
    conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open(Server.Mappath("db/events.mdb"))
    dim rs
    rs = Server.CreateObject("ADODB.recordset")

    rs.Open ("SELECT * FROM events WHERE eventName = '" & eventName & "' ", conn)
    do until rs.EOF
    dim x
    for each x in rs.Fields
    if x.name = eventName then
    eventName.Text = x.Value

    end if
    next
    rs.MoveNext
    loop
    rs.Close
    conn.close

    End if
    end sub


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •