Still a real new beginer...

Results 1 to 2 of 2

Thread: Still a real new beginer...

  1. #1
    Join Date
    Dec 1969
    Posts
    118

    Default Still a real new beginer...

    Well now the asp work and I can talk with my database ! I followed the FAQ about the database and everything is done fine.<BR><BR>My asp now look like :<BR><BR>&#060;%<BR> Dim objConn<BR> Set objConn = Server.CreateObject("ADODB.Connection")<BR> objConn.ConnectionString = "DSN=mp3db"<BR> objConn.Open<BR><BR> Dim objRS<BR> Set objRS = Server.CreateObject("ADODB.Recordset")<BR> <BR> Dim strSQL<BR> strSQL = "SELECT * FROM Song"<BR> objRS.Open strSQL, objConn<BR>%&#062;<BR>&#060;html&#062;<BR><BR>&#06 0;head&#062;<BR>&#060;title&#062;L&#039archive&#06 0;/title&#062;<BR>&#060;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&#062;<BR>&#060;meta name="GENERATOR" content="Microsoft FrontPage 4.0"&#062;<BR>&#060;meta name="ProgId" content="FrontPage.Editor.Document"&#062;<BR>&#060 ;style type="text/css"&#062;<BR>&#060;!--<BR>A:link{text-decoration: none; color: #FFFF00;}<BR>A:visited{text-decoration: none; color: #FFFF00;}<BR>A:active{text-decoration: none; color: #FFFF00;}<BR>A:hover{text-decoration: none; color: #00ff00;}<BR>--&#062;<BR>&#060;/style&#062;<BR>&#060;meta name="Microsoft Border" content="b, default"&#062;<BR>&#060;/head&#062;<BR><BR>&#060;body background="images/fond.gif" bgproperties="fixed" bgcolor="#000000" text="#FF0000"&#062;<BR><BR>&#060;div align="center"&#062;<BR> &#060;center&#062;<BR> &#060;table border="0" cellpadding="0" cellspacing="0" width="95%"&#062;<BR> &#060;tr&#062;<BR> &#060;td width="100%"&#062;<BR> &#060;p align="center"&#062;&#060;font face="Arial" size="7" color="#008080"&#062;&#060;strong&#062;&#060;em&#0 62;L&#039ARCHIVE&#060;/em&#062;&#060;/strong&#062;&#060;/font&#062;&#060;/p&#062;<BR> &#060;div align="center"&#062;<BR> &#060;center&#062;<BR> &#060;table border="1" width="50%"&#062;<BR> &#060;tr&#062;<BR> &#060;td width="20%"&#062;Titre&#060;/td&#062;<BR> &#060;td width="20%"&#062;Artiste&#060;/td&#062;<BR> &#060;td width="20%"&#062;Album&#060;/td&#062;<BR> &#060;td width="20%"&#062;Genre&#060;/td&#062;<BR> &#060;td width="20%"&#062;D├ębit&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;% Do Until objRS.EOF = True %&#062;<BR> &#060;tr&#062;<BR> &#060;td width="20%"&#062;&#060;% =objRS("Songtitle") %&#062;&#060;/td&#062;<BR> &#060;td width="20%"&#062;&#060;% =objRS("Songartist") %&#062;&#060;/td&#062;<BR> &#060;td width="20%"&#062;&#060;% =objRS("Songalbum") %&#062;&#060;/td&#062;<BR> &#060;td width="20%"&#062;&#060;% =objRS("Songgenre") %&#062;&#060;/td&#062;<BR> &#060;td width="20%"&#062;&#060;% =objRS("Songbitrate") %&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;% objRS.MoveNext %&#062;<BR> &#060;% Loop %&#062;<BR> &#060;/table&#062;<BR> &#060;/center&#062;<BR> &#060;/div&#062;<BR> &#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;/table&#062;<BR> &#060;/center&#062;<BR>&#060;/div&#062;<BR>&nbsp;&#060;/body&#062;<BR><BR>&#060;/html&#062;<BR><BR>And that work very well.<BR><BR>So, I can use this on each pages of my site BUT, I know that there is a file named global.asa that seems to do the database connection once and do not need to be re-done in each page. But, how can I do that ? When I moved the first 4 lines to the global.asa file in a Sub session, it didn&#039t worked at all...<BR><BR>What should I do ?<BR>Again, please help !<BR><BR>A+++<BR>Bruce<BR>http://www.bheller.com

  2. #2
    minnie Guest

    Default RE: Still a real new beginer...

    I am also a new beginner...<BR> I have used just one connection in global.asa and called that in all pages..<BR>Here we go..<BR><BR>Global.asa<BR><BR>Sub Application_OnStart<BR> Application("strConnUser") = "DSN=someDSNName;UID=someUser;Password=somepasswor d"<BR>End sub<BR><BR>Now in all the pages you can just use...<BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR>objConn .open Application("strConnUser")<BR><BR>then..y&#039r remaining code....<BR><BR><BR>I hope this helps!!!

Posting Permissions

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