a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

1 value in 3 columns

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> 1 value in 3 columns
Page: [1]
 
lu lu

 

Posts: 418
From: wpg, mb
Status: offline

 
1 value in 3 columns - 5/9/2003 14:13:58   
How can i create a simple form that uses a text box value to submit the value under 3 columns in the same table, I using fp so connecting to teh database to submit under 1 column is easy, how can i submit under 2 other colums, the column names are job1, job2 & job3, so the text box value enterered by the user , upon submit enters into job1, job2 and job3 column, i' m using the unique autonumber named " id" .

any ideas.?.?. thank you
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: 1 value in 3 columns - 5/9/2003 14:39:51   
If it were me (and I was using the DRW) , I' d use the Custom Query feature and use a Query something like:

UPDATE DISTINCTROW myTable SET job1=' ::job::' , job2=' ::job::' , job3=' ::job::' WHERE ID=::ID::

See how I used the same form field for each DB field? Hope it helps...

< Message edited by rdouglass -- 5/9/2003 2:46 PM >


_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to lu lu)
lu lu

 

Posts: 418
From: wpg, mb
Status: offline

 
RE: 1 value in 3 columns - 5/9/2003 16:06:55   
thanks rdouglass,

I decided not to use the drw but hand code it, i got a weird error:

ADODB.Recordset error ' 800a0cb3'

Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.

I know i have read write permissions set on the folder that the database is in.... I also have a drw change db info form which works, so i thinnk that elinminates out " not support updating" & " limitation of the provider"

The script is simple... what could be wrong:

<%@ Language=VBScript %>

<%
  Response.buffer = true
  Response.ExpiresAbsolute = Now() - 1
  Response.Expires = 0
%>

<%
Set connDB = Server.CreateObject(" ADODB.Connection" )
connDB.Open " DBQ="  & Server.MapPath(" ..\fpdb\success2.mdb" ) & " ;"  & _
" DRIVER=Microsoft Access Driver (*.mdb)" 
sql = " SELECT Job_Address_1 FROM Results" 
Set rs = connDB.Execute(sql)
%>


<%
  Sub saveToDB()
 
  
	RS.AddNew
	
	RS(" Job_Address_1" ) = new_job
	RS(" Job_Address_2" ) = new_job
	RS(" Job_Address_3" ) = new_job	
	RS.Update
	
	RS.Close : connDB.Close
	Set RS = Nothing : Set connDB = Nothing
  End Sub
  %>

<html>

<head>
<title>Admin</title>

</head>

<body>
<form>
  <p><font face=" Arial Black" >Current Job Sites:</font></p>
<%While Not rs.EOF%>
  <select>
<option value=" <%=rs(" Job_Address_1" )%>" ><%=rs.Fields(" Job_Address_1" )%></option>
<%
rs.MoveNext
Wend
%>
 </select>
</form>

 <p> </p>
<form method=" POST"  action=" admin2.asp" >
  <p><font face=" Arial Black"  size=" 3" >Add New Job Site:</font></p>
  <p><input type=" text"  name=" new_job"  size=" 100" ></p>
  <p><input type=" submit"  value=" Submit New Job Site To Database"  onSubmit=" <%Call saveToDB%>" ></p>
</form>

 <p> </p>




< Message edited by lu lu -- 5/9/2003 4:08 PM >

(in reply to lu lu)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: 1 value in 3 columns - 5/9/2003 16:25:58   
quote:

sql = " SELECT Job_Address_1 FROM Results"


I think you' re problem is here but I' m not postitive. I' ve never opened a SELECT query for writing. Why couldn' t you just use the UPDATE instead (in place of your SELECT query).

Are you trying to edit or add records? It looks like you' re trying to list them then update them.

Also, do you need to cycle thru the whole recordset or just the 1 submitted record?

I wish I knew more of what you were trying to do...:) However, don' t worry - all this stuff is done every day and its not re-inventing the wheel....

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to lu lu)
lu lu

 

Posts: 418
From: wpg, mb
Status: offline

 
RE: 1 value in 3 columns - 5/9/2003 18:24:35   
what i' m trying to do:

[1] populated a list box of the values in the table Results, column Job_Address_1. I' d like to see the drop box of current job addresses.
[2] have a form that has a text field named ' new_job" and submits the new_job value to the table Results columns Job_Address_1, Job_Address_2, Job_Address_3. Thats what the script above is trying to do.

afterwards goal:
Redirecting back to the page after form submission to see the new_job listed in the drop box.

(in reply to lu lu)
lu lu

 

Posts: 418
From: wpg, mb
Status: offline

 
RE: 1 value in 3 columns - 5/10/2003 13:08:32   
Ok , i kind got it working but it the sql changes the values in the table, I am looking to just add the value, now that i think about it i fear that i have a bigger problem then expected - incorrect database layout, me thinks i need a seperate table to add the job addresses to choose from then include these address in the drw intake page to write to the Results table which then the records can be modified. I guess a saying like this could apply to me, " Inexperience cause me to can' t think about what I don' t know, therefore can' t foresee"

(in reply to lu lu)
J-man

 

Posts: 936
From: Canada
Status: offline

 
RE: 1 value in 3 columns - 5/10/2003 13:46:03   
maybe the saying could be express in asp:

<%@ Language=VBScript %>
<%Response.BrainBuffer = true%>
<%
Dim inexperience

Set patheways = Server.CreateObject(" ADODB.BrainWay.Connection" )
patheways.Open " DBQ=" & Server.MapPath\/Brain/\(" ..\..\frontalLobe.mdb" ) & " ;" & _
" DRIVER=Microsoft Access Driver (*.mdb)"
sql = " SELECT * FROM Main"
Set rs = patheways.Execute(sql)
%>

<%While Not rs.EOF%>
inexperience = <%=rs(" knowHow" )%>
<%
rs.MoveNext
Wend
%>

<%
If inexperience > 0 Then
response.write (" things are good" )
Else
reponse.write (" need to learn more" )
End If
%>

hmmm... can someone test that for me?

< Message edited by J-man -- 5/10/2003 1:47 PM >

(in reply to lu lu)
Doug G

 

Posts: 1189
Joined: 12/29/2001
From: SoCal
Status: offline

 
RE: 1 value in 3 columns - 5/10/2003 18:13:48   
If it helps, recordsets returned from a conn.execute(sql) are read-only recordsets.

If you want an updateable recordset, you can create the rs, specify the recordset location, cursortype & locktype, set the activeConnection to your connection object and issue an rs.open like this fragment

..
..
rs.CursorLocation = adUseClient
rs.CursorType = adStatic
rs.LockType = adLockOptimistic
rs.open strSql, myConn
..
..



_____________________________

======
Doug G
======

(in reply to lu lu)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> 1 value in 3 columns
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts