I receive: Microsoft VBScript compilation error '800a0411' Name redefined /FPNew2/client/database_connection2.asp, line 14 Dim Conn ----^ I understand why, but how do I work around this. Code for the database_connection file attached (both files are the same except for the name of the database). Thanks in advance for a solution to this one! <% Session.Timeout=540 'User name for the SQLServer var_UserID = "myusername" 'Password for the SQLServer (blank if no password) var_Password = "mypassword" 'Name of the Data Base in the SQLServer for connection var_DatabaseName = "fp_vticket" 'SQL SERVER IP sql_ip = "sql ip address" sql_port = "1433" Dim Conn Set Conn = Server.CreateObject("ADODB.Connection") Conn = "Driver={SQL Server};Server=" & sql_ip & ";Address=" & sql_ip & "," & sql_port & ";Network=dbmssocn;Database=" & var_DatabaseName & ";Uid=" & var_UserID & ";Pwd=" & var_Password & ";" dim rs, rs1, str,rsstate,rscountry ,rschild,rstemp,rs_thismonth, rsheading, rsdata set rs=server.CreateObject("adodb.recordset") set rs1=server.CreateObject("adodb.recordset") set rstemp=server.CreateObject("adodb.recordset") set temprs=server.CreateObject("adodb.recordset") set rs_check=server.CreateObject("adodb.recordset") set rschild=server.CreateObject("adodb.recordset") set rsconn=server.CreateObject("adodb.recordset") set rsdata=server.CreateObject("adodb.recordset") %> <% Function Val(i) If isNull(i) or isEmpty(i) or trim(i) = "" or not isnumeric(i) Then Val = 0 Else Val = i End Function Function IIf(i,j,k) If i Then IIf = j Else IIf = k End Function ' Declaring Error Messages sub errorinit() session("errormsg") = "" end sub sub errorcompile(displaytag, errorstatement) if displaytag = "li" then session("errormsg") = session("errormsg") & "
  • " & errorstatement & "
  • " else session("errormsg") = session("errormsg") & errorstatement & "
    " end if end sub function erroroutput() if trim(session("errormsg")) <> "" then session("errormsg") = "" & session("errormsg") & "" end if erroroutput = session("errormsg") end function call errorinit() %> [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => bake01 [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> Database Connection Problem - Macromedia Dynamic HTML

    Database Connection Problem - Macromedia Dynamic HTML

    I have a SQL query: select distinct vt_contact.vt_folder_id, jobmaster.customernumber from fp_vticket.dbo.vt_contact, confirm.dbo.jobmaster where vt_folder_id = customernumber This uses two SQL databases: fp_vticket and confirm. The problem occurs when I have two include files on my ASP page: <!-- #include file="database_connection.asp" --> <!-- #include file="database_connection2.asp" --> I receive: Microsoft VBScript compilation error '800a0411' Name redefined /FPNew2/client/database_connection2.asp, line 14 Dim Conn ----^ I understand why, but how do I work around this. Code for the database_connection file attached (both files are the same except for the name of the database). Thanks in advance for a solution to this one! <% Session.Timeout=540 'User ...

    1. #1

      Default Database Connection Problem

      I have a SQL query:

      select distinct vt_contact.vt_folder_id, jobmaster.customernumber
      from fp_vticket.dbo.vt_contact, confirm.dbo.jobmaster
      where vt_folder_id = customernumber

      This uses two SQL databases: fp_vticket and confirm.

      The problem occurs when I have two include files on my ASP page:

      <!-- #include file="database_connection.asp" -->
      <!-- #include file="database_connection2.asp" -->

      I receive:

      Microsoft VBScript compilation error '800a0411'
      Name redefined
      /FPNew2/client/database_connection2.asp, line 14
      Dim Conn
      ----^

      I understand why, but how do I work around this. Code for the
      database_connection file attached (both files are the same except for the name
      of the database).

      Thanks in advance for a solution to this one!




      <%
      Session.Timeout=540
      'User name for the SQLServer
      var_UserID = "myusername"
      'Password for the SQLServer (blank if no password)
      var_Password = "mypassword"

      'Name of the Data Base in the SQLServer for connection
      var_DatabaseName = "fp_vticket"
      'SQL SERVER IP
      sql_ip = "sql ip address"
      sql_port = "1433"

      Dim Conn
      Set Conn = Server.CreateObject("ADODB.Connection")
      Conn = "Driver={SQL Server};Server=" & sql_ip & ";Address=" & sql_ip & "," &
      sql_port & ";Network=dbmssocn;Database=" & var_DatabaseName & ";Uid=" &
      var_UserID & ";Pwd=" & var_Password & ";"

      dim rs, rs1, str,rsstate,rscountry ,rschild,rstemp,rs_thismonth, rsheading,
      rsdata
      set rs=server.CreateObject("adodb.recordset")
      set rs1=server.CreateObject("adodb.recordset")
      set rstemp=server.CreateObject("adodb.recordset")
      set temprs=server.CreateObject("adodb.recordset")
      set rs_check=server.CreateObject("adodb.recordset")
      set rschild=server.CreateObject("adodb.recordset")
      set rsconn=server.CreateObject("adodb.recordset")
      set rsdata=server.CreateObject("adodb.recordset")
      %>

      <%

      Function Val(i)
      If isNull(i) or isEmpty(i) or trim(i) = "" or not isnumeric(i) Then Val = 0
      Else Val = i
      End Function

      Function IIf(i,j,k)
      If i Then IIf = j Else IIf = k
      End Function

      ' Declaring Error Messages
      sub errorinit()
      session("errormsg") = ""
      end sub

      sub errorcompile(displaytag, errorstatement)
      if displaytag = "li" then
      session("errormsg") = session("errormsg") & "<li>" & errorstatement & "</li>"
      else
      session("errormsg") = session("errormsg") & errorstatement & "<br>"
      end if
      end sub

      function erroroutput()
      if trim(session("errormsg")) <> "" then
      session("errormsg") = "<font class=""comment"">" & session("errormsg") &
      "</font>"
      end if
      erroroutput = session("errormsg")
      end function
      call errorinit()
      %>

      bake01 Guest

    2. #2

      Default Re: Database Connection Problem

      If you want to easily join tables in two databases you should look in to using
      stored procedures. I have some that insert into two tables and just wrote a
      query that does an inner join from two table in two different dbs. Stored
      procedures also have increase query performance and multiple pages can use the
      same SP. I just remade a site that now has every query a Stored Procedure and
      the page load time is obviously faster.
      Or
      Try using a query with one connection string and use the full db identifiers
      dbName.schemaName.tableName.columnName


      MikeL7 Guest

    3. #3

      Default Re: Database Connection Problem

      but how do I work around this

      Manually change Conn in one of the connctions to anything else. Maybe
      Conn2. It i just a var do a search replace to take care of all
      instances.
      Philo Guest

    Similar Threads

    1. problem with database connection
      By shellll in forum Macromedia Dynamic HTML
      Replies: 2
      Last Post: April 13th, 08:43 PM
    2. Database Connection Problem
      By jaz872 in forum Coldfusion Database Access
      Replies: 0
      Last Post: April 14th, 05:50 PM
    3. ASP Access Database Connection Problem
      By GavW in forum Dreamweaver AppDev
      Replies: 5
      Last Post: March 13th, 08:46 PM
    4. Problem connection to an Oracle Database ??
      By Greg in forum Oracle Server
      Replies: 1
      Last Post: August 19th, 08:12 PM
    5. ASPX database connection problem
      By Albert in forum ASP.NET General
      Replies: 0
      Last Post: August 8th, 11:07 PM

    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
    •  

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139