Results 1 to 15 of 25
Related
-
HTML table to Database Forum: HTML Forum
Replies: 2 -
Script database 29,000 Records for sale Forum: Websites For Sale
Replies: 1
-
04-04-2007, 05:03 AM #1
inseting records to a database through html code...
hi,,, i have this html page that consists of fields name,tel,etc...
i want when the user fills the fields and presses submit the data will be stored in the database,,,
the database is stored in this path:C:\Documents and Settings\NooraS\My
Documents\noora\Ammar\myweb71")_
i wrote this code but it doesn't store the data , any help:
HTML Code:<% set myconn = server.createobject("adodb.connection") dbpath = server.mappath("C:\Documents and Settings\NooraS\My Documents\noora\Ammar\myweb71") connection = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & dbpath & "\Ammar.mdb" myconn.open (connection) set result = server.createobject("adodb.recordset") set result = myconn.execute(strSQL ) %>
HTML Code:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta http-equiv="Content-Language" content="en-us"> <title>ares Product 1</title> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <!--mstheme--><link rel="stylesheet" type="text/css" href="_themes/global/glob1111.css"><meta name="Microsoft Theme" content="global 1111, default"> <meta name="Microsoft Border" content="tlb, default"> </head> <body ><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td> <% set myconn = server.createobject("adodb.connection") dbpath = server.mappath("C:\Documents and Settings\NooraS\My Documents\noora\Ammar") connection = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & dbpath & "\Ammar.mdb" myconn.open (connection) set result = server.createobject("adodb.recordset") set result = myconn.execute(strSQL ) %> <p> <a href="index.htm">Home</a></p> <p> <img src="_derived/prod01.htm_cmp_global110_bnr.gif" width="600" height="60" border="0" alt="Buy"> <br> <img src="_derived/prod01.htm_cmp_global110_hbtn_p.gif" width="140" height="50" border="0" alt="Buy" align="middle"> <script language="JavaScript"><!-- MSFPhover = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 ))); function MSFPpreload(img) { var a=new Image(); a.src=img; return a; } // --></script><script language="JavaScript"><!-- if(MSFPhover) { MSFPnav1n=MSFPpreload ("_derived/new_page_1.htm_cmp_global110_hbtn.gif"); MSFPnav1h=MSFPpreload ("_derived/new_page_1.htm_cmp_global110_hbtn_a.gif"); } // --></script><a href="new_page_1.htm" language="JavaScript" onmouseover="if(MSFPhover) document ['MSFPnav1'].src=MSFPnav1h.src" onmouseout="if(MSFPhover) document ['MSFPnav1'].src=MSFPnav1n.src"><img src="_derived/new_page_1.htm_cmp_global110_hbtn.gif" width="140" height="50" border="0" alt="Sell" align="middle" name="MSFPnav1"></a> </p> <p> </p> </td></tr><!--msnavigation--></table><!--msnavigation--><table dir="ltr" border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top" width="1%"> <p> </p> <p> </p> </td><td valign="top" width="24"></td><!--msnavigation--><td valign="top"> <p>Please fill out the following form in order to process your order.</p> <p>Name <input type="text" name="T1" size="20"></p> <p>Address &nb sp; <input type="text" name="T1" size="20"></p> <p>Tel / Mobile & nbsp; <input type="text" name="T1" size="20"></p> <p>Product description <input type="text" name="T1" size="20"></p> <p>Credit card number <input type="text" name="T1" size="20"></p> <p align="center"><b><a href="toppage1.htm">Submit</a></b></p> <!--msnavigation--></td></tr><!--msnavigation--></table><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td> <p> </p> <h5> Send mail to <a href="mailto:webmaster@eshopping.com"> webmaster@eshopping.com</a> with questions or comments about this web site.<br> Copyright © 2007 AR e-shopping<br> Last modified: 03/02/07 </h5> </td></tr><!--msnavigation--></table></body> </html>
-
04-04-2007, 05:42 AM #2
Re: inseting records to a database through html code...
sorry this is the correct code
HTML Code:<% dim strSQL set myconn = server.createobject("adodb.connection") set dbpath = server.mappath("C:\Documents and Settings\NooraS\My Documents\noora\Ammar") connection = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & dbpath & "\Ammar.mdb" myconn.open (connection) set result = server.createobject("adodb.recordset") set result = myconn.execute(strSQL ) strSQL = "INSERT INTO [Buy_info](name, address,Tel/Mobile, Product description, Credit card number) Values ('" &name & "' , '" & address & "' , '" & tel & "' , '" & products_des & "' , '" & cc_no & "' )" myconn.execute(strSQL) %>
Last edited by nawaray; 04-04-2007 at 05:47 AM.
-
04-04-2007, 10:14 PM #3
Re: inseting records to a database through html code...
There are a couple of possible problems that I see with your SQL statement. In Microsoft Access, I don't believe you can have brackets around your table name. I'm not entirely sure about that but try the query without those brackets. Secondly, on that SQL statement you have:
Code:('" &name & "' ,
Code:('" & name & "' ,
Code:Response.Write strSQL Response.End
Music Around The World - Collecting tips, trade
and want lists, album reviews, & more
-
04-05-2007, 12:38 AM #4
Re: inseting records to a database through html code...
hi,,,
i tried what you said but still i don't get the records stored in the database
is my code correct?
-
04-05-2007, 05:59 AM #5
Re: inseting records to a database through html code...
Did you do the second half of my suggestion, which was to display the query from your code, copy the query and try to run it through Microsoft Access? BTW, what does that displayed query look like?
Music Around The World - Collecting tips, trade
and want lists, album reviews, & more
-
04-06-2007, 03:33 PM #6
Re: inseting records to a database through html code...
yes i tied the second part i still didn;t work, ok this is what i want how can i do this,,,
if i have a database stored in an A:\ drive say for example test , and i have the html pages stored there to, if one of the html pages contains fields that i should fill in like (name, address, etc) and then when i press the submit button the record should be stored in the database , how can i write this code?
-
04-06-2007, 08:01 PM #7
Re: inseting records to a database through html code...
OK, but you didn't answer this question:
BTW, what does that displayed query look like?Music Around The World - Collecting tips, trade
and want lists, album reviews, & more
-
04-07-2007, 02:55 AM #8
Re: inseting records to a database through html code...
i don't understand what you mean?
my form consists of fields that should be filled and then when i click on submit it should be saved in the table
-
04-07-2007, 11:24 AM #9
Re: inseting records to a database through html code...
I suspect the problem is with your query. That's why I want to see what the query looks like. This is just a means of debugging your code, trying to find out what's wrong. So, I repeat - What does your displayed query look like?
Music Around The World - Collecting tips, trade
and want lists, album reviews, & more
-
04-07-2007, 02:55 PM #10
Re: inseting records to a database through html code...
this is my code...
as i said before that when i press the submit button i don't grt any error , this is my insert query:
HTML Code:strSQL = "INSERT INTO [Buy_info](name, address,Tel/Mobile, Product description, Credit card number) Values ('" &name & "' , '" & address & "' , '" & tel & "' , '" & products_des & "' , '" & cc_no & "' )"
<FONT color=#000080>HTML Code:dim strSQL set myconn = server.createobject("adodb.connection") set dbpath = server.mappath("C:\Documents and Settings\NooraS\My Documents\noora\Ammar") connection = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & dbpath & "\Ammar.mdb" myconn.open (connection) set result = server.createobject("adodb.recordset") set result = myconn.execute(strSQL ) strSQL = "INSERT INTO [Buy_info](name, address,Tel/Mobile, Product description, Credit card number) Values ('" &name & "' , '" & address & "' , '" & tel & "' , '" & products_des & "' , '" & cc_no & "' )" myconn.execute(strSQL) %>
-
04-07-2007, 09:38 PM #11
Re: inseting records to a database through html code...
Change your code to the following. Run it. Tell me what is displayed.
Code:dim strSQL set myconn = server.createobject("adodb.connection") set dbpath = server.mappath("C:\Documents and Settings\NooraS\My Documents\noora\Ammar") connection = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & dbpath & "\Ammar.mdb" myconn.open (connection) set result = server.createobject("adodb.recordset") set result = myconn.execute(strSQL ) strSQL = "INSERT INTO [Buy_info](name, address,Tel/Mobile, Product description, Credit card number) Values ('" &name & "' , '" & address & "' , '" & tel & "' , '" & products_des & "' , '" & cc_no & "' )" Response.Write strSQL Response.End myconn.execute(strSQL) %>
Music Around The World - Collecting tips, trade
and want lists, album reviews, & more
-
04-08-2007, 08:49 AM #12
Re: inseting records to a database through html code...
hi ,,,, i copied and pasted what you told me and i did not get anythig , when i pressed the submit button nothing appeared it took me to the home page
-
04-08-2007, 08:59 AM #13
Re: inseting records to a database through html code...
and is this correct the way i define the connection even if i'm not connect to the server , i mean my folder is saved in disk?
HTML Code:dim strSQL set myconn = server.createobject("adodb.connection") set dbpath = server.mappath("C:\Documents and Settings\NooraS\My Documents\noora\Ammar") connection = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & dbpath & "\Ammar.mdb"
-
04-08-2007, 11:13 AM #14
Re: inseting records to a database through html code...
OK, I'm pretty sure I've figured out what you need. You defined the variable called result twice, essentially overlaying the correct definition with the incorrect definition, here:
Code:set result = server.createobject("adodb.recordset") set result = myconn.execute(strSQL )
Secondly, you're not executing your query string correctly. Change this:
Code:myconn.execute(strSQL)
Code:result.open strSQL, myconn
Code:<% dim strSQL strSQL = "INSERT INTO [Buy_info](name, address,Tel/Mobile, Product description, Credit card number) Values ('" &name & "' , '" & address & "' , '" & tel & "' , '" & products_des & "' , '" & cc_no & "' )" set dbpath = server.mappath("C:\Documents and Settings\NooraS\My Documents\noora\Ammar") set connection = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & dbpath & "\Ammar.mdb" set myconn = server.createobject("adodb.connection") myconn.open connection set result = server.createobject("adodb.recordset") result.open strSQL, myconn %>
Code:strSQL = "INSERT INTO Buy_info (name, address,Tel/Mobile, Product description, Credit card number) Values ('" &name & "' , '" & address & "' , '" & tel & "' , '" & products_des & "' , '" & cc_no & "' )"
Music Around The World - Collecting tips, trade
and want lists, album reviews, & more
-
04-09-2007, 06:21 AM #15
Re: inseting records to a database through html code...
hi,,, this is my final code i wrote ...
HTML Code:<% dim conn set conn=Server.CreateObject("ADODB.Connection") conn.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=C:\\Ammar.mdb" 'this is without a password set rs=Server.CreateObject("ADODB.command") strsql = "INSERT INTO [Buy_info](name, address, tel , products_ des,cc_no) Values('" + Request("name") + "' , '" + Request("address") + "' , '" + Request(" tel") + "' , '" + Request("products_des ")+ "' , '" + Request("cc_no")+ "')" 'strsql="update Buy_info set name='" + request("name")+"' , address='" +request("address") +"' , tel='" + request("tel")+ "', products_des='"+ request("products_des")+"' , email='" +request("email") +"' , cc_no='"+ request("cc_no")+"' " conn.execute(strsql) %>
Script error detected at line 14.
Source line: conn.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=C:\\Ammar.mdb" 'this is without a password
Description: Unrecognized database format 'C:\Ammar.mdb'.
and my database is in the c drive with the given name Ammar, where is the error?
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum