|
| |
|
|
achappell
Posts: 12 Joined: 8/16/2005 Status: offline
|
SQL Insert with Field Concatenation - 8/31/2005 12:44:02
I am trying to write a submission form that allows the user to input the date and time in a text box and several drop down boxes. I need all the fields to concatenate on the insert and I can't seem to figure out how to accomplish this.
|
|
|
|
BeTheBall
Posts: 6385 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: SQL Insert with Field Concatenation - 8/31/2005 14:04:19
What have you tried? What type of database are you using?
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
achappell
Posts: 12 Joined: 8/16/2005 Status: offline
|
RE: SQL Insert with Field Concatenation - 8/31/2005 14:56:47
I am using a microsoft sql server 2000 and basically have the form built but don't know where to go from there on the INSERT statement.
|
|
|
|
BeTheBall
Posts: 6385 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: SQL Insert with Field Concatenation - 8/31/2005 16:52:41
And the db table has one date/time field or one date field and one time field? What are the names of the various form fields that you need to concatenate?
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
achappell
Posts: 12 Joined: 8/16/2005 Status: offline
|
RE: SQL Insert with Field Concatenation - 8/31/2005 18:01:56
The database has one date/time field and the fields I need to concatenate are T1(the date), D1(the hour), D2(the minute), D3(the second), and D4(AM/PM). I am putting them into a table called Hours and the field name the concatenated fields are going into is dIntervalStart.
|
|
|
|
BeTheBall
Posts: 6385 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: SQL Insert with Field Concatenation - 8/31/2005 18:34:32
Try this for starters. Concatenate all your form fields into one variable and then try inserting the variable: varDateTime = Request.Form("T1)&" "&Request.Form("D1")&":"&Request.Form("D2")&":"&Request.Form("D3")&" "&Request.Form("D4") INSERT INTO Hours (dIntervalStart) VALUES ('"&varDateTime&"')
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
achappell
Posts: 12 Joined: 8/16/2005 Status: offline
|
RE: SQL Insert with Field Concatenation - 9/1/2005 9:45:56
I am assuming I have to have two pages to submit this form, one with the actual form and one with the DRW and the sql statement. Where would I place this exactly: varDateTime = Request.Form("T1)&" "&Request.Form("D1")&":"&Request.Form("D2")&":"&Request.Form("D3")&" "&Request.Form("D4")
|
|
|
|
BeTheBall
Posts: 6385 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: SQL Insert with Field Concatenation - 9/1/2005 10:44:46
Probably would be easiest to submit to a second page. You could put the above code anywhere on the second page. I would probably put it at the very top, between script delimiters, i.e., <% varDateTime = Request.Form("T1)&" "&Request.Form("D1")&":"&Request.Form("D2")&":"&Request.Form("D3")&" "&Request.Form("D4") %> Then in the body of the page insert a DRW and in step 2 select, Custom query in which you will place your insert SQL.
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
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
|
|
|