| | |
|
Active Server Pages asp source code database MS SQL MS Access .mdb adovbs.inc cookies calendar codes sql commands scripts asp programming tutorials iis web server components CJWSoft ASPProtect ASPBanner ASPClassifieds
(Advanced)
(Components)
(Database)
(General)
(Vbscript)

|
|
Subject: |
Add new record to SQL DB table |
From: |
Juls |
Date: |
3/21/2001 1:16:18 PM |
IP: |
205.229.199.121 |
Hi,
I have an SQL DB to which I am connecting and trying to write a new record. However I get an error saying that there were errors in DB and points to line: RS.Update
Here is my code, what's going on? am I connecting the wrong way???
varFirstName= TRIM(Request.Form("txtFirstName"))
varLastName= TRIM(Request.Form("txtLastName"))
varAddress= TRIM(Request.Form("txtAddress"))
varSurveyID= TRIM(Request.Form("txtSurveyID")) 'from hidden field
varNumberOfQuestions= TRIM(Request.Form("txtNumberOfQuestions")) 'from hidden field
varSuccessName = "No"
varSuccessQA = "No"
' IF the form is filled in correctly, then write answers to DB
If (varFormStatus = "FilledIn") then
'create database objects and open connections
'--------------------------------------------------------------
ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI; Persist Security Info=False;Initial Catalog=ICHE_Surveys; Data Source = HERCULES"
set DB = Server.CreateObject("ADODB.Connection")
DB.Open ConnectionString
set RS = Server.CreateObject("ADODB.Recordset")
RS.Open "SELECT Participants.ParticipantID, Participants.FirstName, Participants.LastName, Participants.Address, Answers.SurveyID, Answers.QuestionNumber, Answers.Answer, Answers.ParticipantID AS ForeignPartID, Participants.DateParticipated " _
& "FROM dbo.Participants INNER JOIN dbo.Answers ON dbo.Answers.ParticipantID = dbo.Answers.ParticipantID " _
& "WHERE 0 = 1", DB, adOpenKeyset, adLockOptimistic
|
|
|

|
|
|
|