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

How to change the script of an ASP File from another ASP File

Status
Not open for further replies.

Plarent

IS-IT--Management
Dec 25, 2003
4
US
I have an ASP application where the users add fields to the database table as well as to the screen. Basically the users can configure their own screen. So, I have an Admin Page where users can add fields and change the location of the fields and the Page where the data is displayed. I have an insert function where the data is displayed that inserts values of the particular fields in that screen to the table. The problem is, when users add fields, the function is not updated to include the added field values for insertion.
Any Ideas?
Thanks
 
From a table we must collect the Field definitions and finally the Field contents. The program needs to know the types of the fields while showing them, for example a logical field which stores True/False should print either "Yes" or "No" on the Lister and Viewer, and show up as Yes / No Radio Buttons on the Edit form. For the text fields, we also need length so the Editor can make the form elements the proper size. It makes sense to store all this in an array: Field Name, Field Type, and Size. The following piece of code accomplishes this:

strConn = Session("dbConn")
strTable = Session("dbRs")
' Open Connection to the database
set xConn = Server.CreateObject("ADODB.Connection")
xConn.Open strConn
' Open Recordset and get the field info
strsql = "SELECT * FROM " & strTable
set xrs = Server.CreateObject("ADODB.Recordset")
xrs.Open strsql, xConn
intFieldCount = xrs.Fields.Count
Dim aFields()
ReDim aFields(intFieldCount,3)
For x = 1 to intFieldCount
aFields(x, 1) = xrs.Fields(x-1).Name
aFields(x, 2) = xrs.Fields(x-1).Type
aFields(x, 3) = xrs.Fields(x-1).DefinedSize
Next
xrs.Close
Set xrs = Nothing



hth,
Foxbox
ttmug.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top