I am thinking... maybe you should not use the http:// bit. Just keep "addemail.asp", e.g.Code:on (release) { loadVariablesNum("insert.asp", 0, "POST"); }
In addemail.asp file (using VBScript):Code:on (release) { loadVariablesNum("addemail.asp", 0, "POST"); }
That's it.you maye need to change the mappath depending on your web server. Of course you need to customise the database names and table name in the code here for your own useCode:<%@LANGUAGE="VBSCRIPT"%> ' Connection <% YourDatabase_STRING = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" + Server.mappath("/Databases/db_theDatabase.mdb") %> <% myQuery = "INSERT INTO contacts (Email) VALUES ('" & Request("Email") & "' )" ' execute the insert Set editCmd = Server.CreateObject("ADODB.Command") editCmd.ActiveConnection = YourDatabase_STRING editCmd.CommandText = myQuery editCmd.Execute editCmd.ActiveConnection.Close %>
To view the contents of the database, create another file, view.asp:
Most of the database code in ASP files (e.g. SQL, connection, etc.) was easily generated by Dreamweaver Ultra for convinience.Code:<%@LANGUAGE="VBSCRIPT"%> ' Connection <% YourDatabase_STRING = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" + Server.mappath("/Databases/db_theDatabase.mdb") %> <% set Recordset1 = Server.CreateObject("ADODB.Recordset") Recordset1.ActiveConnection = YourDatabase_STRING Recordset1.Source = "SELECT * FROM contacts" Recordset1.CursorType = 0 Recordset1.CursorLocation = 2 Recordset1.LockType = 3 Recordset1.Open() Recordset1_numRows = 0 %> <% Dim Repeat1__numRows Repeat1__numRows = -1 Dim Repeat1__index Repeat1__index = 0 Recordset1_numRows = Recordset1_numRows + Repeat1__numRows %> <HTML><TITLE>What's in the database I wonder?</TITLE><BODY> <% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) %> <TABLE> <tr> <%=(Recordset1.Fields.Item("Email").Value)%> </tr> <% Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 Recordset1.MoveNext() Wend %> </TABLE> <% Recordset1.Close() %> </BODY></HTML>
Any queries, feel free to post here.




Reply With Quote