Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems Adding Records to MDB file

Status
Not open for further replies.

tyleri

Programmer
Jan 2, 2001
173
US
I am having one hell of a time trying to make a form that adds new records to my MDB file. Here are the details:

database.mdb -- the tablename is "news_items", and the 2 fields are "news" and "date".

I have a form with this code:
-----------------------------------------------------------
<table>

<tr>

<form action=&quot;../news_entry.asp&quot; method=&quot;post&quot; name=&quot;news_entry&quot;>

<td valign=&quot;top&quot;>
<font face=tahoma size=3 color=brown><b>date</td>
<td><input type=&quot;text&quot; name=&quot;date&quot; size=&quot;10&quot;></td>

</tr>
<tr>
<td valign=&quot;top&quot;>
<font face=tahoma size=3 color=brown><b>news</td>
<td><textarea COLS=55 ROWS=8 name=&quot;news&quot;></textarea></td> </tr>
<tr>
<td></td>
<td><input type=&quot;submit&quot; value=&quot;submit&quot;></td>


</form>
</tr>
</table>
----------------------------------------------------------

now, i know i need to create an asp page that sends it to the table, but i just can't figure out how to do it - i've been trying for 6 hours straight. Could someone please help me fill in the missing link and help me with some code that will send this info into the MDB access database file? thanks!!!
 
this is what i have come up with - and it just will not function - I get the &quot;Internal Server Error&quot; when i run this.
-------------------------------------------------------

<%
' Declaring variables
Dim news, date, con, data_source, sql_insert, rs

news = Request.Form(&quot;news&quot;)
date = Request.Form(&quot;date&quot;)

data_source = &quot;Provider=Microsoft.Jet.OLEDB.4.0; Data Source=&quot; & _ Server.MapPath(&quot;database.mdb&quot;)

sql_insert = &quot;insert into news_items (news, date) values ('&quot; & sNewsVar & &quot;', '&quot; & sDateVar & &quot;');&quot;

con.Close
Set con = Nothing

%>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top