get info from DB

Results 1 to 2 of 2

Thread: get info from DB

  1. #1
    Join Date
    Dec 1969

    Default get info from DB

    hello, I was hopping that some one could tell me what I&#039;m going wrong here,<BR><BR>I&#039;m trying to pass info from an access mdb to my script with <BR> " & port & " and " & site & " variables,<BR>but the script isn&#039;t getting the info from the db some reason,,<BR>here&#039;s my script so far:<BR><BR><BR>&#060;%<BR>Set MyConn = Server.CreateObject("ADODB.Connection")<BR>ConnStr ing = "DRIVER=Microsoft Access Driver (*.mdb); DBQ=" &Server.MapPath("site.mdb") & ";user=;PASSWORD="<BR>Myconn.Open ConnString<BR> SQL = "Select * From config"<BR> Set rs = myconn.Execute(SQL)<BR><BR> Dim xml, strData<BR><BR> url = "http://" & site & ":" & port & "/title.html"<BR><BR> Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP.4.0")<BR ><BR> xml.Open "GET", url, true<BR> Call xml.Send()<BR><BR> On Error Resume Next<BR> If xml.readyState &#060;&#062; 4 then<BR> xml.waitForResponse 10<BR> End If<BR> If Err.Number &#060;&#062; 0 then<BR> strData = "&#060;b&#062;Error&#060;/b&#062;<BR>check your configuration..."<BR> Else<BR> If (xml.readyState &#060;&#062; 4) Or (xml.Status &#060;&#062; 200) Then<BR> xml.Abort<BR> strData = "there was a problem connecting to shoutcast server...<BR>error - script timed out"<BR> Else<BR> strData = xml.ResponseText<BR> End If<BR> End If<BR>%&#062;<BR><BR>&#060;%=strData%&#062;<BR><BR ><BR>what am I doing wrong here,,?<BR>thankz in advance for your time!<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: get info from DB

    Doesn&#039;t look as if you are setting any values for the variables site and port.. If these are supposed to be coming from your db you need to read them like this:<BR><BR>SQL = "Select * From config"<BR>Set rs = myconn.Execute(SQL)<BR><BR>Dim xml, strData<BR><BR><BR>site = rs("whateverfieldname")<BR>port = rs("whateverfieldname")<BR><BR>url = "http://" & site & ":" & port & "/title.html"<BR><BR>You should also check for rs.eof before trying to read them.<BR><BR>

Posting Permissions

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