use dynamic data in dreamweaver CS6 to populate a hyperlink - asp.net

Basically I have a news page which stores headlines, stories, and a unique story identifier in a SQL database. I want to be able to create a hyperlink on a webpage to the pictures.
so when someone selects a news story from a drop down menu (which uses the headline) and presses submit I want to pass the storyID, which is a unique identifier, to a spot in a hyperlink. so if it was story 134 then then link would look like:
I know the SQL statement would look like:
SELECT StoryID from db.News
Where Headline = {The headline selected in the dropdown menu}
the dropdown menu is called NewsDrop
this would be an ASPX page written with a VB code base
SO I guess I need help passing the variables along to the search string and the hyperlink.
Not even sure if this is even possible.

There are a number of options available to achieve this, the most common would be to using a query string in the hyperlinks in your drop down menu to send a parameter to a SQL stored procedure which would use it in a variable in your select statement. So basically the hyperlinks you have in the drop down menu would be appended with ?storyID=<uniquestoryid> and on the far end SELECT StoryID from db.News Where StoryID = #StoryID it would be less efficient to use the headline from the link as a query string and variable in the where clause as you have shown but if that is your only option it could be done.
However you should proceed carefully when using query strings here is a link to a good basic article about query strings and another link about best practices.

Related

Table input for view

I would like to have the user enter order items on my order form as a table where they input the Qty and Prod #. I've not programmed with that type of field so a blank line would initially display for a new order. They would type a Qty and an item number in the fields and hit enter. When they hit enter from either field, what do I program to check the validity of the two fields. Plus I need the item number to be a drop down/type ahead field. Does anyone have an example of this type of thing they could send me? It would be looking at a view in the product catalog db. Also, after they enter an item to order, that "doc" should get stored/saved and a new blank line should open up.
What type of control do I need to use and should these items be stored in their own form or on the main order document? Could use some guidance here. Thanks.
The question you have is a little broad but I will make a couple suggestions if I can.
You have the main order doc. Then a repeat control with each item. Filter each item by a uniqueID that allows you to join the main doc to the child docs. Each item should be a separate document. You then need to make the items in the repeat control editable.
There is a lot of things going on here and I think you need to get started somewhere. I think the first step is to do a repeat control with response documents.Xpages, Inherited documents in view panel by using #Unique

Jdeveloper query form

I'm trying to create an adf query panel with table but I need to limit the search values as also the result values in the table.
For example:
- I have a table with FName, LName, Dateofbirth, address, phone
- I want that the values presented in the search form are FName, Lname
- the values in the result table Fname, Lname, address, phone
I've checked several links including this one enter link description here
But I can't understand how to limit the values.
There are lot of resources available on the internet on how to implement search functionality in ADF. here are few for your reference:
http://www.baigzeeshan.com/2010/04/creating-simple-search-form-in-oracle.html
https://www.youtube.com/watch?v=LAWSfO-7xR8
http://adfnote.blogspot.com/2013/02/create-simple-search-form-in-oracle-adf.html
Normally a search functionality is implemented using a View Critreia, which is created on a View Object. It shows up in Data Control as a Named Criteria under your View Object instance.
While creating the view criteria you can specify the items that you would want to see in the panel as search fields.
When you use (drag and drop) your view criteria as an 'ADF Query Panel with Table' on a page, you get the option to specify the columns you want to see in the results table. You can restrict the number of columns there, or even afterwards by just removing the unwanted columns from your page.
I was able to make it work, by not checking the attribute option 'Queryable'.
This way the it does not appear in the query form,only in the results table.
Thank you all for your help

Lookup field appears as numerical values instead of text on Access report

I am trying to create a report putting a field called contact which has the name of a person. This name is linked directly to another table where I keep all the contacts.
For some strange reason, when I include this name (which in query view displays as the name of the contact), instead of the name appearing, the unique ID number is shown on my report.
As mentioned in the article cited in the above comment, you can use a Combo Box control on your report to do the lookup for you. To see how this can be done, create a new report based on the table containing the lookup field, then drag and drop that field onto the report. That will create a Combo Box control with properties that look something like this:
Row Source: SELECT [Clients].[ID], [Clients].[LastName] FROM Clients;
Bound Column: 1
Column Count: 2
Column Widths: 0";1"
You could use a similar Combo Box control on your actual report to display the client's name rather than their numeric ID value.
Another alternative would be to change the Control Source of the report's Text Box control to have it do a DLookUp() on the table. If the lookup field is named [client] then changing the Control Source of the Text Box to something like
=DLookUp("LastName","Clients","ID=" & [client])
would also work.
I wanted to add to the great answer by Gord:
When using a "web" database (started in Access 2007 I think), you cannot change a report's fields to ComboBox style, nor can you use DLookUp(). (web databases lack a ton of features)
The workaround for this, if you want to create a Web-Report that uses lookup fields, is to create a Web-Query first based on your Web-Table (all the Web-* stuff has a www planet icon over the logo, if you create a new Web-DB in Access 2007+ you'll see what I mean)
So, instead of Table -> Report, you'll have to do W-Table -> W-Query -> W-Report.
Then, the only thing you need to customize to get the data right is the W-Query. Start by trying to reproduce the look in the query to match what you want users to see in the report. Note that here in the query, lookups will work fine (instead of the unique ID's, you get field names like you want). However, this will not carry over to the report. To do that, you gotta get the actual text field name you want into the query:
You should already have one table in your query; start by adding the table that your first lookup field points to. For example, the table I want to print is called Stock_Boards, and it has a lookup field called PCBID_lookup that points to the table Stock_PCBs.
Since you're using lookup fields, there should already be a relationship line between the two tables when you add the second one. If there isn't, something has gone horribly wrong.
Now, see how that line connects two fields on the two different tables? For example, I've got my PCBID_lookup field on my Stock_Boards table, which connects to the ID field on my Stock_PCBs table. If I created a report from this now, PCBID_lookup would be a number, a number that correlates to the ID of a record on Stock_PCBs.
To fix it, I will add the name field I want to show up on the report. In my example, that happens to be a Part Number, rather than the ID. I add the PartNumber field from my Stock_PCBs table to the query, and remove the PCBID_lookup field of the Stock_Boards table from my query.
Since PartNumber is what I want to show up on my report, it effectively replaces the original field (PCBID_lookup)
Repeat for all lookup fields you want in your report.
I had 1 more: I removed the Status field of the Stock_Boards table (which was an ID/Lookup) and added the 'Status' field from the Status table (which was the actual text name)
When finished, your query should look exactly how you want the data to appear, without any special tricks or asking Access to do something unnatural. Save your query, and create a web-report from it. Done!

Populate a value in combobox dynamicly

I have a form where user picks a Item# and gets info for the selected Item. This form got enhanced by adding another filter, using a combobox control, to select a 'warehouse'.
I could use a lookup for the warehouse(the list is huge) to chosse a 'warehouse' but what am trying to do to query warehouse on Item# value and populate into combobox.
Tried to attached a screen shot, unfotunately, the system doesn't let me do it. If I need to put more details, please let me know.
Is it doable?
I would suggest you to do this with a temporary table. Create one in AOT, and declare it as global variable in your form.
When Item (datasource field or design control, choose what's more accurate for you) is modified, just delete table content, and fill it at your needs.
In the control lookup method, call temporary table lookup method, i.e. "static void lookup(TMPTable _tmpTable)". Do a SysTableLookup, with a standard query over TMPtable, but it's important to use QueryBuildDataSource.setCursor(_tmpTable) (I don't remember now where was method setCursor() in Query or QueryRun, search for it a bit).

vb.net to reduce code for displaying data in textboxes

On the page I have created I have a search facility that if a doctors number is searched it will bring up the doctors details, once search button is clicked the results are displayed in textboxes (I cannot use gridviews because this is not wanted)
sample of code placed on the search button
Query statement = "SELECT DocNumber FROM tblDoctor WHERE DNum LIKE '%"
execute the query and get the result
The result is converted to string and Execute Scalar is used
DocNum.Text = Result1
Query statement = "SELECT DocName FROM tblDoctor WHERE DNum LIKE '%"
execute the query and get the result
The result is converted to string and Execute Scalar is used
DocName.Text = Result2
etc.... there are are 14 other textboxes that I want too display data in, so there is a large amount of repeated lines of code following the structure above. Can anyone suggest a better way of doing this?
Another problem of repetition of code comes from the prev page that is linked to it. The page before has a summary of details of doctors, once the row is clicked it takes you to this page displaying a more detailed view of their personal details. The doctor number selected will be passed onto the more detailed view using a querystring so I have the code
Automatic population of the selected doctors will fill the labels
on page load
Request the query string and store into variable dNum
Query statement = "SELECT DocNumber FROM tblDoctor WHERE DNum = " & dNum"
Get result from query convert to string and use execute scalar
lblDocNum.Text = Res1
Query statement = "SELECT DocNumber FROM tblDoctor WHERE DNum = " & dNum"
Get result from query convert to string and use execute scalar
lblDocNum.Text = Res1
etc...
What I am doing works correctly but the coding style looks poor. Any help would be much appreciated.
Thank you
Why not use a DataReader or DataSet or whatever you prefer to return the whole record, then simple move from column to column and populate the textboxes that way? Instead of returning one value at a time.
If the goal is less code,
SELECT * FROM tblDoctor WHERE xxx
into a DataTable or DataReader, as Thyamine suggested, above.
From there, you could also put the textboxes in an HTML table in a Repeater which you will bind to that datatable. You won't have to individually assign any of the values, the databinding will do it for you!
I know that people think HTML tables are evil but it's the easiest way to line up the labels I assume you will also want.
I also know that the control I suggested is called a Repeater but you only have one record. If you don't tell the compiler, I won't. :)
From parts of your question, it sounds like you're wondering whether to send all of the bits of information along in the querystring but that doesn't sound like a good idea to me because it invites users to mess with the data in the querystring.
You didn't mention - are these textboxes meant for editing? A Save button inside the Repeater would have easy access to all of the controls to build your update statement. You could also put the Save button outside the repeater and refer to the repeater's first Item to find the controls.

Resources