|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
function addRowToTable -Post new ROW to DB
I have a table where I have used the code to have a new row added when selecting a button. It has this code behind it:
function addRowToTable() { var tbl = document.getElementById('Detail'); var lastRow = tbl.rows.length; // if there's no header row in the table, then iteration = lastRow + 1 var iteration = lastRow; var row = tbl.insertRow(lastRow); var cell1 = row.insertCell(0); var el = document.createElement('input'); el.setAttribute('type', 'text'); el.setAttribute('name', 'txtRow' + iteration); el.setAttribute('size', '10'); cell1.appendChild(el); I'm adding a row that has 4 cells. The first row is defined with values that are pushed to a SQL Database, and the update works fine. However, any of the "new" rows created by using the function do NOT update to the DB. I need help on how to label the new rows (fields) correctly- and to get those recognized by my SQL statement. sConnString = "Provider=SQLOLEDB; Data Source=; Initial Catalog=; User ID=; Password=; Network Library=dbmssocn;" Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open(sConnString) sSQL = "INSERT INTO AftHrs (ddate, ihours, vname, vemail, ibackup, iincident) VALUES ('" & ddate & "','" & ihours & "','" & vname & "','" & vemail & "','" & ibackup & "','" & iincident & "')" sSQL1 = "INSERT INTO AftHrsDet (vcaller, vcomments, ddatedet, iincidentdet, ihourswork) VALUES ('" & ReplaceQuotes(vcaller) & "','" & ReplaceQuotes(vcomments) & "','" & ddatedet & "','" & iincidentdet & "','" & ihourswork & "')" |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > function addRowToTable -Post new ROW to DB |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|