Dynamic SQL commands within ASP?


I just have really more of a SQL command question than about ASP, but all the rest of my code is in ASP.

Application Description:
I've created a website that is meant to be used for Church Music Departments. I made the website dynamic to accomodate the various churches out there. Everyone involved in the music department can log in to this website and grab .mp3's for songs they need to learn, and the chord charts and lyrics.

The Groups I have are:
Choir
Mass Choir
Ensemble
Musician
Worship Leader
.
.
.


Depending on the church size, they may have 6 groups, 10 groups, whatever, so it's variable, and they can call their groups anything they want.

Here are the following tables that I have:

tbl_Members
MemberID
FirstName
LastName
..
.

tbl_Groups
GroupID
GroupName (which the groups names are listed up above)

tbl_GroupMember
GroupMemberID
MemberID (related to MemberID above)
GroupName

This last table simply contains the MemberID, and assigns the GroupName that the member is a part of.

I have a webpage that I created in ASP that works well... it's just not that efficient. If I want to edit the groups that a member belongs to, the webpage lists all the groups, with a delete button next to it. One by one, you can delete them. It also has a listbox near the bottom that allows you to add groups to that member. Once you add one group, it simply updates that page again and shows it at the top that it's been added. Again, adding a group is done one at a time.

What I would like to do to save a lot of time is having this page dynamically load up all the groups (like the listbox does), except with a checkbox option next to each one. The groups that the member is a part of would be checked. The ones they are not, would be unchecked. you have to do to add/remove those groups from that members would be to check or uncheck those boxes.

Now, I think I could figure out the ASP portion of the job, what I don't know... is how to make a SQL line that would know to update 5, 6, 8, or 10 groups... or however many groups there are.

I keep running into this roadblock where I need the ability for the SQL command to be dynamic as well, as I only seem to be able to use SQL if I know I have a fixed number of groups to add/update/or delete.

Can you point me in the right direction

Posted On: Friday 26th of October 2012 12:43:24 AM Total Views:  197
View Complete with Replies

RELATED TOPICS OF ASP PROGRAMMING LANGUAGE




Problem creating dynamic Array

Essentiallly this is the code::: Code: This counts the number of checkboxes in a form. I have a form that has an array of checkboxes. This piece of code counts the number of checkboxes in each row. The problem is that the varible MyNewRandomNum changes each time the page is loaded. I can't do dim row(MynewRandomNum). So instead I try creating a dynamic array of dim row(). When I do that though I get a error of "Subscript out of range" and it points to the line where I'm assigning values to each index of the array (row(i) = check2). From what I was reading "Subscript out of range" means your trying to access areas of the array which don't exist. I'm not doing this anywhere in the program. The thing is that I have another line of code that is pretty much the same as this but it counts the number of checks in each column. The only difference is that the loops are reversed and the array works perfectly.
VIEWS ON THIS POST

338

Posted on:

Friday 26th October 2012
View Replies!

Creating dynamic variables from an array

hi. i have about 100 rows in a table.i would like to dump all the rows into an array, then assign each field to a dynamically created variable. here is my current code: Code: Set rs=conn.Execute("SELECT GJName, AltTitle FROM GrandJury ORDER BY ID") agj=rs.GetRows() rs.Close: Set rs=Nothing For i=0 To 24 gj & i+1 = agj(0,i) Next i'm trying to make a variables from gj1-gj100. i tried using the "&" but that doesn't work. is this even possible
VIEWS ON THIS POST

191

Posted on:

Friday 26th October 2012
View Replies!

Check box, dynamic list and submit

Goodday to all of you! I really need help here. I tried one ASP code from Webthang (multiple deletes using checkboxes and submit button). The code runs perfectly (credits to Rob Boyle). Now I would like to add a dropdown menu that has delete, active and inactive for the menu. The dropdown menu name is "cSelect2", the checkbox is "cSelect" and the form is "frmselect". But I receive the error message "No value given for one or more required parameters. /t/testrecord2.asp, line 25 " after perform the delete function. The code stucks at the execute part. Below is the code Code:
VIEWS ON THIS POST

199

Posted on:

Friday 26th October 2012
View Replies!

Client-side dynamic triple linked dropdown, using asp & javascript..

hey frends.. i used this code,to implement a dynamic-double linked listbox.. it works fine..how can i extend it as a triple linked list kindly guide me.. Code: Dependentlists function listboxchange(p_index) { switch (p_index) { case "" : document.form1.listbox2.options[]=new Option("",""); break; } return true; } -Select- -Select- regards, kanith..
VIEWS ON THIS POST

216

Posted on:

Friday 26th October 2012
View Replies!

How can I build a HTML table dynamically from a recordset?

How can I build a table from a recordset I have the header information, but I need to add rows to the table from the recordset.
VIEWS ON THIS POST

341

Posted on:

Friday 26th October 2012
View Replies!

Generating dynamic design

I have an array of records, would like to put them into X no of tables depending on the number of records. The max X is 3. For eg, i have 15 records in the array I would to have record 0,3,6,9,12,15 in table 1,record 1,4,7,10,13 in table 2, record 2,5,8,11,14 in table 3. I tried to use 3 for loop, it did the job but is there a better way to do. Would appreciate any advice and help.
VIEWS ON THIS POST

203

Posted on:

Friday 26th October 2012
View Replies!

Unable to get dynamic image to display

I am trying to output an image using a filename from a database. My code: Response.Write("") Response.Write("") The first example works but doesn't display the image The second example works and always displays the image I don't know what is wrong with my code as the images are definitely on the server
VIEWS ON THIS POST

249

Posted on:

Friday 26th October 2012
View Replies!

Updating dynamic value

I would like to update my database with entered values. here is an example main_page.asp will have an update of prices on a single click but different value for each field, say product_1 will be updated by entering the new price from 20 to 25, product_2 will be updated from 30 to 35 and product_3 wont be updated. so far I have this command but I know it must be dynamic, how could I do it please Code: this bit is the text field to enter the data Code: cheers
VIEWS ON THIS POST

205

Posted on:

Friday 26th October 2012
View Replies!

Check which Button (Form) has been clicked (dynamic names)

Hi , I am a ASP-Newbie and also new in this forum. Right now I am programming a small Voting-System in ASP using an Access database. The Voting-System can be used by any user. Everyone is allowed to add and delete questions. Every Question has a "Delete-" and "Edit-Button". The Names for the Buttons are generated by my programm. The Names are combined with the Primary Key from the database. My code looks lik that: PHP Code: response.write("") \t\t\t\t\t\tresponse.write("") So every button has a different name. e.g. delete165 My problem is, that I dont know how to figure out which button has been clicked, because of the different names that are generated. I just know the possiblity like that: PHP Code: Request.Form("ButtonName") The problem is, that there are more than one Delete- or Edit-Button. How can i figure ou which one has been clicked I hope you understand what my problem is. Sorry for my english. ;-)
VIEWS ON THIS POST

229

Posted on:

Friday 26th October 2012
View Replies!

How to make a dynamic array

how do i create a array rs, not sure if the terminology is correct. but i don't want a obj rs i want a array. an example would be great,
VIEWS ON THIS POST

303

Posted on:

Friday 26th October 2012
View Replies!

CSS dynamic menu

people! This my first post to this forum. I am building up a web application which should have a two level dynamic (ASP) css menu. My problem is that I do not know how I could make id="active" to show on pages that are on certain folder. I should be able to do this because I have to use following code on sub menu: Code:
VIEWS ON THIS POST

206

Posted on:

Friday 26th October 2012
View Replies!

Displaying dynamic data

I have an access db which i record my test data. i want to display the data for 1 day in 1 row, i have added an extra field with am1,am2,lu1,lu2,pm1,pm2,ev1,ev2 the data has one of these in the record to denote it postion on the tablerow but how to loop through the entire db grouping the row with the same date hope this makes sense Snalls.
VIEWS ON THIS POST

179

Posted on:

Friday 26th October 2012
View Replies!

Search based on dynamic criteria

and thanks ahead of time. I was wondering if someone could lead me in the right direction. This is what I would like to do: A user will be able to choose a home for example based on criteria. The only requirement will be to choose a state. From their they can narrow down their search by the following (these will be dropdowns with options): county series type split bedroom footage range price range sort by bedrooms bathrooms 1/2 baths garage They don't have to choose in that order. I will have all that info in an access database and I am using ASP script. So the user can choose a state then depending on what options they choose, all the other criteria adjust dynamicly, and if a user selects another criteria all the other criteria changes as well as the ones they may have already chosen, and so on. So basiclly when a user hits submit form they will always have a result.
VIEWS ON THIS POST

266

Posted on:

Friday 26th October 2012
View Replies!

dynamic dropdown not populating - Page 2

it is actually inches, but i thought of that already and prob will go with it. cheers Smalls
VIEWS ON THIS POST

307

Posted on:

Friday 26th October 2012
View Replies!

Help with dynamic Listboxes

Hi Guys, I'm new to ASP but today I managed to populate a couple of drop down boxes from a back-end database using the dynamic bind values in Dreamweaver. However, theres a problem. I have two listboxes, ones called location and the other is called classroomNo. What I want is when the user clicks on say "Location 1" from the Location drop down box I want the corresponding classrooms for that location only to appear in the following 'ClassroomNo' drop down box. So if the user click on 'Innovation Centre for the location, all classrooms for that location would only be available in the classroom drop down box. The values for the locations and classrooms for each location are stored in a table called "Classroom_Locations" an example shown below of the table: classroom: location: N0.02 Minerva Building G0.35 Greig Building G0.36 Greig Building Can anyone shed some light upon this problem Thank you Jonathan
VIEWS ON THIS POST

160

Posted on:

Friday 26th October 2012
View Replies!

linked comboboxes - 1st one hardcoded, second one dynamic - Page 2

hi, tried using your code, but i get the following error: Microsoft VBScript runtime error '800a0009' Subscript out of range: 'ubound'
VIEWS ON THIS POST

212

Posted on:

Friday 26th October 2012
View Replies!

ASP.NET 2.0 ObjectDataSource with dynamic fields

there, I am looking into ObjectDataSource with my business tier. As I know so far ObjectDataSource is using those public properties of the data time as the data field. This works fine if I have known properties added to the code. For example class MyDataItem { public string Name
VIEWS ON THIS POST

141

Posted on:

Friday 26th October 2012
View Replies!

Reading dynamic form data values

I'm sure I'm confusing myself here but I thought I'd ask just to be sure. I'm used to dealing with forms which are static in that I code all the elements and I know how many there will be in advance. However I'm trying to create a page for edit functionality for a file store I'm making. At present that page will pull all of the details for each file and then print these details to a table in a form. For each row in the table I populate various input boxes and drop downs with the relevant values and values, so that the user can edit. I also add a checkbox so that the user can delete a file. My question is this, When the user has made all the changes and presses submit, How do I access the form elements in the asp page I pass the form data to I mean will each one need it's own name like "Delete" or is there an esier way of doing this.
VIEWS ON THIS POST

222

Posted on:

Friday 26th October 2012
View Replies!

zip a folder dynamically without using any component

hello any body help me regarding this. my problem is i want to download a folder (folder contains .gif files) from a server. which is the best way to download, 1.zip a folder 2. or can we download a folder i am trying to zip a folder but without using any component. can any one help me regarding this. when i search in google i got code using only component. I want code using pure asp. Please Help me.
VIEWS ON THIS POST

397

Posted on:

Friday 26th October 2012
View Replies!

Passing dynamic data to a page

I have a page with textboxes and dynamic dropdowns. the problem is when i submit the form to another page which has Code: to display what i have submitted prior to me writing it to the db i get the text from the text boxes, but nothing in the code to display what is selected in the dropdowns. Code is available if required, any help most appreciated. Smalls
VIEWS ON THIS POST

165

Posted on:

Friday 26th October 2012
View Replies!