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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check if field exists in database using ASP

Status
Not open for further replies.

melusi

IS-IT--Management
Jul 31, 2002
13
ZA
I have an access database.I want to add a info into a table only if it's not there.
I have this sample code which it's not lilanga = Request.Form("Days")
ummango = Request.Form("Comms")
lusuku = Request.Form("Tikhatsi")

set conn = Server.CreateObject("ADODB.Connection")
conn.Open "SKPE"
SQLIST="SELECT * FROM schedule"
set list=conn.execute(SQLIST)
Do While Not list.eof
If (<%=list(&quot;Day&quot;)%> = '&quot;& lilanga &&quot;') Then
response.write &quot;<b> A Similar Meeting has been scheduled <\b><\p>&quot;
list.movenext
Loop
Else
SQL=&quot;INSERT INTO schedule (Day,Officer,TaskToPerform,Department,ScheduledTime,DateofTask,Duration,Community) Values (&quot; &_
&quot;'&quot; & request.form(&quot;Days&quot;) & &quot;', &quot; &_
&quot;'&quot; & request.form(&quot;Officers&quot;) & &quot;', &quot; &_
&quot;'&quot; & request.form(&quot;Details&quot;) & &quot;', &quot; &_
&quot;'&quot; & request.form(&quot;Departments&quot;) & &quot;', &quot; &_
&quot;'&quot; & request.form(&quot;Tikhatsi&quot;) & &quot;', &quot; &_
&quot;'&quot; & request.form(&quot;Dates&quot;) & &quot;', &quot; &_
&quot;'&quot; & request.form(&quot;Durations&quot;) & &quot;', &quot; &_
&quot;'&quot; & request.form(&quot;Comms&quot;) & &quot;')&quot;
set cars=conn.execute(SQL)
End If
 
In case anyone sees this and starts to answer, ther is another similar post where I have already started answering, we might one to all use that one and keep the answers in one place.

-Tarwn ________________________________________________________________________________
Sometimes it is how you ask the question: faq333-2924
Many ASP questions have already been answered, please check faq333-3048 and use the search tool before posting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top