Hey,
I am trying to add a record to my SQL database. I am using MS InterDev to create my ASP pages. I have a form in which the user inputs the info, then they click to submit the information. When clicking submit they are directed to my Conf.asp which contains the code to add the new record. I am really new to all of this and am totally confused. I tried using the SQL INSERT method but it doesn't work. I also tried the AddRecord Method with the UpdateRecord Method still no luck. I am desperate for some help. I am posting my code to this page. I know it is long but maybe someone can help me figure out what I am doing wrong.
This is the SQL statement that I tried - no luck
This is the other method I tried - still no luck
This is the Run Time Text for my DTC Recordset
If anyone could give me a clue I would greatly appreciate it!!!
Thanks so much!
tbmishue:-(
I am trying to add a record to my SQL database. I am using MS InterDev to create my ASP pages. I have a form in which the user inputs the info, then they click to submit the information. When clicking submit they are directed to my Conf.asp which contains the code to add the new record. I am really new to all of this and am totally confused. I tried using the SQL INSERT method but it doesn't work. I also tried the AddRecord Method with the UpdateRecord Method still no luck. I am desperate for some help. I am posting my code to this page. I know it is long but maybe someone can help me figure out what I am doing wrong.
Code:
<%@ Language=VBScript %>
<SCRIPT id=DebugDirectives runat=server language=javascript>
// Set these to true to enable debugging or tracing
@set @debug=true
@set @trace=true
</SCRIPT>
<% ' VI 6.0 Scripting Object Model Enabled %>
<!--#include file="_ScriptLibrary/pm.asp"-->
<% if StartPageProcessing() Then Response.End() %>
<FORM name=thisForm METHOD=post>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
Sub cretbtn_onclick()
thisForm.action = "AppointForm.asp"
thisForm.submit
End Sub
</SCRIPT>
</HEAD>
<BODY>
<%
internala = Request.Form("internaltxt")
froma = Request.Form("fromtxt")
cateogrya = Request.Form("categorytxt")
locationa = Request.Form("locationtxt")
rooma = Request.Form("roomtxt")
subjecta = Request.Form("subjecttxt")
personala = Request.Form("personaltxt")
toemaila = Request.Form("toemailtxt")
startdatea = Request.Form("startdttxt")
starttimea = Request.Form("starttimetxt")
enddatea = Request.Form("enddttxt")
endtimea = Request.Form("endtimetxt")
This is the SQL statement that I tried - no luck
Code:
sqlStatemtent = "INSERT INTO calendarinfotable
(DepartmentSchool, Category, Subject, Room, Location, StartDate, StartTime, EndDate, EndTime, Intranet, Toemailm, Personal) VALUES ('"& cstr(froma) & "',' "& cstr(categorya) &"', '"& cstr(subjecta) &"', '"& cstr(rooma) &"', '"& cstr(locationa) &"', '"& cstr(startdatea) &"', '"& cstr(starttimea) &"', '"& cstr(enddatea) &"', '"& cstr(endtimea) &"', '"& cstr(internala) &"', '"& cstr(toemaila) &"', '"& cstr(personala) &"')"
This is the other method I tried - still no luck
Code:
CalRecordset.addRecord
CalRecordset.fields.setValue ("DepartmentSchool", froma)
CalRecordset.fields.setValue ("Category", categorya)
CalRecordset.fields.setValue ("Subject', subjecta)
CalRecordset.fields.setValue ("Room", rooma)
CalRecordset.fields.setValue ("Location", locationa)
CalRecordset.fields.setValue ("StartDate", startdatea)
CalRecordset.fields.setValue ("StartTime", starttimea)
CalRecordset.fields.setValue ("EndDate", enddatea)
CalRecordset.fields.setValue ("EndTime", endtimea)
CalRecordset.fields.setValue ("Intranet", internala)
CalRecordset.fields.setValue ("Toemail", toemaila)
CalRecordset.fields.setValue ("Personal", personala)
CalRecordset.updateRecord
%>
This is the Run Time Text for my DTC Recordset
Code:
<!--#INCLUDE FILE="_ScriptLibrary/Recordset.ASP"-->
<SCRIPT LANGUAGE="JavaScript" RUNAT="server">
function _initCalRecordset()
{
if (typeof(Session('s_CalRecordset')) == 'undefined')
{
var DBConn = Server.CreateObject('ADODB.Connection');
DBConn.ConnectionTimeout = Application('CCSCalendar_ConnectionTimeout');
DBConn.CommandTimeout = Application('CCSCalendar_CommandTimeout');
DBConn.CursorLocation = Application('CCSCalendar_CursorLocation');
DBConn.Open(Application('CCSCalendar_ConnectionString'), Application('CCSCalendar_RuntimeUserName'), Application('CCSCalendar_RuntimePassword'));
var cmdTmp = Server.CreateObject('ADODB.Command');
var rsTmp = Server.CreateObject('ADODB.Recordset');
cmdTmp.ActiveConnection = DBConn;
rsTmp.Source = cmdTmp;
cmdTmp.CommandType = 2;
cmdTmp.CommandTimeout = 30;
cmdTmp.CommandText = '"calendarinfotable"';
rsTmp.CacheSize = 100;
rsTmp.CursorType = 3;
rsTmp.CursorLocation = 3;
rsTmp.LockType = 3;
Session('s_CalRecordset') = rsTmp;
}
else
rsTmp = Session('s_CalRecordset');
CalRecordset.setRecordSource(rsTmp);
CalRecordset.open();
}
function _CalRecordset_ctor()
{
CreateRecordset('CalRecordset', _initCalRecordset, null);
}
function _CalRecordset_dtor()
{
CalRecordset._preserveState();
}
</SCRIPT>
If anyone could give me a clue I would greatly appreciate it!!!
Thanks so much!
tbmishue:-(