Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2008

Tip: Looking for answers? Try searching our database.

This should be a simple fix...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ddobrzenski - 28 Apr 2008 02:29 GMT
I am getting error messages with my ASP below.  I don't have much experience
in this coding, so hopefully someone will be able to fix my code and get me
on my way.

Thanks,

Danny

Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
</head>

<body>
<%
  ' Declaring variables
  Dim name, email, phone, username, password, location, contact,
data_source, con, sql_insert

  ' A Function to check if some field entered by user is empty
  Function ChkString(string)
  If string = "" Then string = " "
  ChkString = Replace(string, "'", "''")
  End Function

  ' Receiving values from Form
  names = ChkString(Request.Form("name"))
  email = ChkString(Request.Form("email"))
  phone = ChkString(Request.Form("phone"))
  username = ChkString(Request.Form("username"))
  passwords = ChkString(Request.Form("password"))
  location = ChkString(Request.Form("location"))
  contact = ChkString(Request.Form("contact"))

  data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
           Server.MapPath("\db/mainnew.mdb")
  sql_insert = "insert into customers (name, email, phone, username,
password, location, contact) values ('" & _
           name & "', '" & email & "', '" & phone& "', '" & username& "',
'" & password& "', '" & location& "', '" & contact & "')"
           
  ' Creating Connection Object and opening the database
  Set con = Server.CreateObject("ADODB.Connection")
  con.Open data_source
  con.Execute sql_insert
  ' Done. Close the connection
  con.Close
  Set con = Nothing
  Response.Write "Congratulations, all information was loaded into database."
%>

</body>
</html>
Duane Hookom - 28 Apr 2008 05:12 GMT
You might want to use Response.Write() in your code to display the
sql_insert. Also, your page should display the error message with a suggested
line. We can't see this from where we sit.

Signature

Duane Hookom
Microsoft Access MVP

> I am getting error messages with my ASP below.  I don't have much experience
> in this coding, so hopefully someone will be able to fix my code and get me
[quoted text clipped - 52 lines]
> </body>
> </html>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.