Ask a Question related to Microsoft SQL / MS SQL Server, Design and Development.
-
JasonM #1
Insert from ASP to SQL using recordset data as values in insert statement
Hi guys this is my first post and I am a programming hack who is trying to learn. I am attempting to insert a record into an MS SQL DB table based upon a combination of textbox text, recordset data and sql sub-queries as my values. I am enumerating the scripting so that there is a new txtbox ID, new java function
Set Conn = Server.CreateObject("ADODB.Connection")
ConfConn="DRIVER={SQL Server}; Server=home; UID=user; PWD=pass; Database=DB01"
Conn.open ConfConn
set rs = conn.execute("EXEC Stored_Proc1")
Response.Write "<table ID = DataTbl Border=1 CellPadding=0 CellSpacing=0>"
Response.Write "<tr style='background-color:#60759B'>"
For Each objField in rs.Fields
Response.Write "<td><FONT COLOR=#ffffff><center><bold>" & objField.Name & "</bold></center></FONT></td>"
Next
Response.Write "</tr>"
Counter = 0
do until rs.EOF
Counter = Counter + 1
Response.Write "<TR>"
Response.Write "<TD>" & rs(0) & "</TD>"
Response.Write "<TD>" & rs(1) & "</TD>"
Response.Write "<TD>" & rs(2) & "</TD>"
Response.Write "<TD>" & rs(3) & "</TD>"
Response.Write "<TD>" & rs(4) & "</TD>"
Dim stuff0
set stuff0 = rs(0)
q1quest = "SELECT PatSys FROM Enc WHERE EpsId = stuff0"
set q1 = conn.execute (q1quest)
q2quest = "SELECT AdmSys FROM Enc WHERE EpsId = stuff0"
set q2 = conn.execute (q2quest)
Response.Write "<SCRIPT LANGUAGE=" & chr(34) & "JavaScript" & chr(34) & ">function UpdClmSts" & Counter & "(){sql =" & chr(34) & "insert into EntEvt (EntSys, AdmSys, EtrDat, EvtTyp, BegDatTim, EndDatTim, EvtTxt, PhySys, FacSys) values (" & q1 & ", " & q2 & ", " & NOW() & ", CT, " & NOW() & ", Status" & Counter & ".Text , 0, 0 )" & chr(34) & ";} </SCRIPT>" & "<TD>" & rs(5) & "<br><INPUT TYPE=TEXTAREA SIZE=" & chr(34) & " 25,5" & chr(34) & " ID = Status" & Counter & "><br><Center><BUTTON onClick= "& chr(34) & "UpdClmSts" & Counter & "(); " & chr(34) & ">Update Claim Status</BUTTON></Center>" & "</TD>"
Response.Write "<TD>" & rs(6) & "</TD>"
Response.Write "<TD>" & rs(7) & "</TD>"
Response.Write "<TD>" & rs(8) & "</TD>"
Response.Write "<TD>" & rs(9) & "</TD></TR>"
rs.MoveNext
loop
rs.close
conn.close: set conn = nothing
Response.Write "</table>"
I would like to comment my code but I do not know where it is safe to do that. Believe it or not, I have a lot of creative code that is working well! All help is welcome. Thanks in advance.
Junior Member
- Join Date
- Jun 2011
- Location
- Arlington, MA
- Posts
- 1
-
INSERT Statement Query
Hi, I am about to embark on performing a data migration into a MySQL database. The goal is to be able to take the input data, and generate SQL... -
Help with INSERT INTO statement
I'm getting the following error on a query. I haven't seen this one before. Any ideas on what I'm doing wrong? Thanks. Error Executing Database... -
What is wrong with this insert statement?
Here is the code: (I'll put the error below) <cfquery datasource="hubclub"> INSERT INTO Customers, Orders ( Customers.FirstName,... -
INSERT statement contains fewer items than the insert list
The block of code below shows how I am inserting field values into my dbase table: strSQLStatement = "INSERT INTO tblArticles... -
Insert Statement help
Hello, I am having some difficulty keeping my data consistent throughout my tables. I have 3 tables that I need to be "synch'd up"....



Reply With Quote

