DataSource Controls :: SQL And Linking 2 Tables To Check Value?
Apr 12, 2010
i have a job application process where users apply for a job, in the admin section administrators want to be able to see which applications have not been viewed. Now i have one page which lists all the job vacancies and then users can click into that specific vacancy to see which people have submitted an application. This all works fine.
However on the page i display the job vacancies i need to make it so that if there are any applications within a vacancy that need viewing it appears in RED.
The two tables i am using are below:
tbl_vacancies
job_id
job_name
location
voucher
details
availability
region
date_added
tbl_applications
application_id
job_id
fname
sname
other_info
.
.
.
.
date_addedd
viewed
Now the viewed column is in tbl_applications table, the applications relate to a specific vacancy via the job_id.
So what i need to check is IF there are ANY applications where the viewed = 0, if so that means that there are applications that need to be seen, and i want this to appear in RED.
Now i tried this several ways i.e an INNER JOIN etc.. but the full list of vacancies won't appearing.
So i tried this:
[Code]....
[Code]....
This doesnt work at all. I have a datareader which runs through the returns, i don't get any errors, and the applications display correctly but when i use the IF to check it doesnt work..
View 2 Replies
Similar Messages:
Jan 19, 2010
I'm having trouble linking a form view I have on a web page with a drop down list on the same page. Basically, what I need to happen is whenever a new selection is chosen from the drop down list, the details in the form view should also change to represent that selection's criteria.
I have my drop down list connected to SQLDataSource1 and my form view to SQLDataSource2, and these are populating as expected, it's just the problem lies when changing the selection in the drop down list - the form view doesn't follow what is selected.
does anything have to be added in the properties options of either the data source controls or the form view? For example, in the "Events" section, there is a "DataBinding" and "DataBound" selection item that can be used - should anything be entered in this to connect the two?
PS - Here is the code I have in the back end of the page:
[Code]....
View 2 Replies
Aug 1, 2010
How do I insert the selections made on several checkboxes into the WHERE clause of a SQL SELECT statement? The scenario is as follows: the user selects one or more checks in different check boxes to determine the rows to be parsed in a SQL table. Then the user clicks on a Submit button and the result fills a Repeater table. How do I do this, and how do I configure the button to launch the SelectCommand?
View 2 Replies
Jul 27, 2010
I have a horizontal menu control populated (in static mode: StaticDisplayLevels="1" MaximumDynamicDisplayLevels="0") from a site map.
I have another vertical menu control in the left toc of the page that I want to populate from the same sitemap but to be the children of the node selected in the first menu.
View 4 Replies
Jul 16, 2010
I'm attempting to hook up multiple DropDownLists to a single SQLDataSource, but I want the SQLDataSource to return different rows depending on which DropDownList it is populating.
Say I have a table full of names (we'll call it TABLE_NAMES):
[code]....
....and I have two dropdown lists, one with a list of person names and one with a list of dog names.
Is there a way to link up each of these dropdown lists to a single SQLDataSource and use the SelectParameter to differentiate between which records I want returned for each dropdown list?
To make matters worse, these dropdown lists will appear within a GridView control....so there will be multiple instances of each dropdown list depending on how many rows there are in the GridView.
View 1 Replies
Feb 4, 2010
My website is working but when I host it up, the connection are all screw up. Is it because my connectionString are all linked via SqlDatasource and is for local files only? Whats the coding that I need to put in so that my site will connect to the database via accessing the web.config or server?
View 11 Replies
Nov 16, 2010
am trying to use a stored procedure for the Delete Command, I don't see how to set the parameter values to link to the grid values.When using text command, I would just use "WHERE Row_ID = @Row_ID" (Row_ID being the first column of the grid, and the primary key of the table.)How do I do this using a strored procedure?
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>" SelectCommand="usp_MA_Lookup_Callbacks" SelectCommandType="StoredProcedure"
[code]...
View 1 Replies
Jan 28, 2011
I've editing a create user wizard to add a 2nd step, this step will collect the users address. i can't get the second step to save into a table. I'm completely new to visual web developer, so if you reply please make it as jargon free as possible, see source code and vb code, i think i'm missing code for the "finish Button click"
Source code is. [Code]....
Code Behind the wizard control
Partial Class Registration
Inherits BasePage [Code]....
View 7 Replies
Jul 12, 2010
I have the following tables and fields in SQL:
[Code]....
I'd like to create an XML file(based on the above tables mentioned) which I'd like to bind to a treeview control, but I'm not sure how to do that.
View 2 Replies
Nov 23, 2010
I am very new to Linq , i want to check if the PrintingAdminSetting table has rows in it and then if it has then i want to get the value and assign it to txtMaxJobs textbox
below is teh code
, please let me know teh syntax to check .
var DC = new ServiceDataContext();
var rec = DC.PrintingAdminSetting.Where("").First();
txtMaxJobs.Text = rec.ParaName.ToString();
View 4 Replies
Apr 28, 2010
How to get data from two tables through linq .1 ) productsDetails 2) productsImages to bind further listview.
View 1 Replies
May 13, 2010
From using the command: EXEC sp_spaceused on a SQL 2008 database,
the DB has a size of 642.56 MB, unallocated space 148.77 MB.
I can also see the size of the individual tables from the same command:
Reserved: 103656 KB
Data: 98264 KB
Index_size: 2656 KB
Unused: 2736 KB
What I don't quite get is why the total database size is 642.56 MB when the size of the individual tables is so much smaller. We pay for the total amount, in chunks of 500 MB. I was trying to see which tables where causing the DB to be so big, but to me, it looks like it is not the size of the tables but something else.
What should I look at to figure out why we are taking up so much space? Am I not understanding how this works?
View 6 Replies
Jun 15, 2010
I want to know that how many tables we can have in database and what is the maximum no. of columns.I also want to know the maximum size for each datatype.
View 3 Replies
Apr 27, 2010
I need to join some tables to get the matching records. I often have to ask around to see how certain tables could be joined. Is there any way to query the information schema or some thing else to see what columns/values match in certain tables in order to figure out how tables should be joined.
View 4 Replies
Jun 3, 2010
how i insert,update and delete data in multiple table .such tables in which primary and foreign key constraint are
View 1 Replies
May 13, 2010
I'm creating entity on a project to use them as data on my website. I got my base simple entity Users and my DataContext. The thing is i would like the database to create the table as i create Entities.
I mean, actually my database doesn't have a Users table and do not generate it as i build and launch the project. I used to be a Java dev and in Java the table can be created with JPA so i guess Microsoft made it possible with ASP.net but how to do? I've looked on the web but didn't find it.
View 2 Replies
Jun 29, 2010
Apologies if this is in the incorrect forum.. just a question about how to best structure some tables for a particular presentation of data. In the following table (2nd column) you'll see that each motorcycle product applies to a range of years. What is the best way to store this range of years in a relational db? At the moment I have a datefrom and a dateto field for the two ranges, but that may complicate things when I want to filter the table by a particular year. E.G. datefrom is 2006 & dateto is 2010 and I would like to filter by products for a 2008 model.
View 4 Replies
Apr 13, 2010
I have a problem where I would like to get a comma-separated list of items from a couple of tables as part of a set of results. All the searching I've done so far has produced results for dealing with one or two tables. I have four, and can't get my head around how to adapt the sql to deal with it.
I have the following layout:
*Table_Castings*
+---- CastingID {PK}
| MouldID
| SerialNo
| CastRef
| MeltCode
| Signature
|
|
| *Table_CastCertificates* *Table_Certificates*
| CertificateID {PK} ----------- CertificateID {PK}
+---- CastingID {PK} Description
FileID -----------------+
|
|
*Table_CertificateFiles* |
FileID {PK} -------------+
FullLocation
The results I would like include the following columns:
CastingID, MouldID, SerialNo, CastRef, MeltCode, [Certificates],
Where Certificates is a comma separated list of Description + " " + FullLocation records. (What I'll actually do is add http:// and other html codes to make FullLocation a hyperlink, but I can do that.)
Some SQL I've already got is this:
DECLARE @str VARCHAR(500)
SELECT @str = COALESCE(@str + ', ','') + '<a href="http://' + Table_CertificateFiles.FullLocation + '">' + Table_Certificates.Description + '</a>'
FROM Table_CastCertificates INNER JOIN
Table_Certificates ON Table_CastCertificates.CertificateID = Table_Certificates.CertificateID INNER JOIN
Table_CertificateFiles ON Table_CastCertificates.FileID = Table_CertificateFiles.FileID
WHERE (CastingID = 45)
SELECT output = @str
This actually gives all records in the for the specific casting, but I keep getting an error at the "=" in @str = COALESCE when I try joining it to another query to get each casting.
View 3 Replies
Jun 17, 2010
[Code]....
View 2 Replies
Feb 2, 2010
I don't know if I'm posting this in the right place - I have a feeling it can't be too difficult but I can't seem to figure it out. I've come across this problem many times and I've never solved it. I would imagine the scenario is commonplace - I have a table of Products with a PK of ProductID, and a table of related images with a FK of ProductID. Each product can have many images, but for my initial display I want to display one product record with one image record. I have a Sequence field in the Images table and I could pick the lowest one. Right and left Joins return too many records - if I have three images for Product 1 then Product 1 is listed three times.
I've gotten around this before using a flag in the Products table, or listing an image in both tables but I'm sure there must be a SQL statement that can get the information that I need.
View 5 Replies
Feb 17, 2010
I have a details view form inserting data into one table successfully with no problems and picking up the ID parameter from a session.
What i would like to do is one insert SOME of the fields NOT ALL get inserted into another table.
Table 1 = course
table 2 = matrixoneantwo
I tried creating a datasource which inserted data into Matrixoneanttwo and called it from the detailsview_inserting event (sqldatasource.insert() but then i realised that this data source is seperate to my current one and therefore cannot use its parameters.
View 11 Replies
Mar 27, 2010
I have 2 tables with UserId and FirstName, LastName Columns that I want to combine the data in a Select Statement or Stored Procedure
1. The 2 tables will never have the same data, each table will be distinct
2. I want to combine first and lastnames to a full name (t1.FirstName + ' ' + t1.LastName) AS FullName
3. The statement will be used to populate a dropdownlist with UserId as Value, and Name as text
I am unsure how to accomplish this since I do not need to connect the tables, but combine the Sum of their data.
View 6 Replies
Apr 21, 2010
I want to make some check before I add a list of data
so I create a temp table
[Code]....
and this is the qeury I retrive from DataBase
[Code]....
so now I get 2 data resultI just want to knowhow to compare these 2 data result?
[Code]....
then now allow to add new data...
View 2 Replies
Mar 16, 2011
I have a searchbox where i ask for information to a table, but i want to rewrite the code so i can search from several tables.
Here is my temporary select command which works great when using only one table:
[Code]....
View 3 Replies
Jan 20, 2010
I'm quite new to ASP.NET and i was wondering if someone could answer some of my questions.1. What is the difference between a DataTable and an Array? Is the DataTable a serverside control? Is it exposed to the user?2. Does the reader retrieve the column names? If so- how can I capture them? Are they the first row?2. Is it possible to populate an Array using the following sort of code, and if so- how?:
SqlCommand tableCommand = new SqlCommand();
SqlConnection tableConnection = new SqlConnection();
tableCommand.Connection = tableConnection;
[code]...
View 2 Replies