How To Join And Show Data In Browser
Mar 21, 2007
This is the select statement I'm currently using but I can't seem to get the browser to show any data. It just shows the table structure.
I use the g and the p as aliases. Easier maintenance this way.
strSQL = "SELECT g.GuestID, g.ProgramID, p.ProgramID AS Expr1, g.GuestName, g.GuestDescription, p.URL, p.Description FROM dbo.T_ProgramGuests g INNER JOIN dbo.T_ProgramLinks p ON g.GuestID = p.LinkID WHERE p.ProgramID = " & Request("ProgramID")
I have an ASP page where the above sql code is embedded. I have two SQL tables. One is called T_ProgramGuests and the other is called T_ProgramLinks. The asp page basically does a read only of the two tables and is suppose to return the results inside of the html tables I have in the asp page. But all I see when I test is the html and the tables are devoid of data.
HERE IS THE PAGE CODE:
<%
on error resume next
set con = Server.CreateObject("ADODB.Connection")
con.Open "File Name=E:webserviceCompanyCompany.UDL"
set recProgram = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT g.GuestID, g.ProgramID, p.ProgramID AS Expr1, g.GuestName, g.GuestDescription, p.URL, p.Description FROM dbo.T_ProgramGuests g INNER JOIN dbo.T_ProgramLinks p ON g.GuestID = p.LinkID WHERE p.ProgramID = " & Request("ProgramID")
recProgram.Open strSQL,con
%>
<TABLE border="1" cellspacing="0" border="1" width="70%">
<p><b>Guest Name and Description:</b></p>
<tr>
<th width="35%" align="left">Guest Name</th>
<th width="45%" align="left">Guest Description</th>
<tr>
<TD headers="t2"><%=recProgram.Fields("GuestName")%></TD>
<TD headers="t3"><%=recProgram.Fields("GuestDescription")%></TD>
</tr>
</table>
<TABLE border="1" cellspacing="0" border="1" width="70%">
<br /><br />
<p><b>URL and Description:</b></p>
<tr>
<th width="35%" align="left">URL</th>
<th width="45%" align="left">Description</th>
<tr>
<TD headers="t4"><%=recProgram.Fields("URL")%></TD>
<TD headers="t5"><%=recProgram.Fields("Description")%></TD>
<%'
recProgram.Close
con.Close
set recProgram = nothing
set con = nothing
'response.write err.Description
%>
</body>
</html>
I am new to using the advanced features of SQL and could sure use some help with this.
View 2 Replies
ADVERTISEMENT
Aug 26, 2015
I created SSAS cube in VS 2008 and have been able to deploy it successfully to the server. While creating the cube I was able to browse dimensions and all underlying tables just to make sure it has data. After deploying successfully when I drag and drop any measure group to browser it does not display anything.
The only thing I did different from straightforward cube building process was that when I created those measure groups the partitions that were created by default were giving me some unknown errors so I had to delete them in order for cube to process successfully.
Did that made any difference because I thought partitions are for improving query performance and has nothing to do with cube processing errors.
View 9 Replies
View Related
Apr 5, 2007
Hi ,
I've got two tables.. the first table carried a ProductID, and amongst other things a TradePrice
The other tbl carries a ProductID, a IndivPrice and a CustomerID
The second tbl lists prices for products for indiv Customers.
My Query needs to bring back ALL the products from the first tbl...
It also needs to show the TradePrice for that product.
I need to join my query to the second tbl...
And finally, if the second tbl has a price for that product AND the customerID is the same as one I pass into the query.. show that price also..
So here's my first query:
SELECT dbo.Products.ProductID, ProductName, ProductTradePrice, IndivPrice, dbo.Trade_PriceLists.CustomerID AS PLCustomerID FROM dbo.Products LEFT OUTER JOIN dbo.Trade_PriceLists ON dbo.Products.ProductID = dbo.Trade_PriceLists.ProductID WHERE (ProductType = 'Trade' OR ProductType = 'Both') AND (Replace(Lower(ProductBrand),' ','') = 'brandname') AND (CustomerID IS NULL OR CustomerID = 'teste' OR CustomerID = '') ORDER BY TradeOrder
I thought that would work, but what happens is that, if that particular customer has no indiv prices set.. then it only shows the ones that have no records at all in that second tbl..
So unless there is a record for a particular product in that second tbl and it doesn't have a CustomerID assigned to (which would never happen as that tbl is only every for indiv customer prices) then it doesn't show.
Examples:
First Tbl
ProductID Name TradePrice
1 Jumper £1.00
2 Jeans £3.00
3 Shoes £5.00
4 Hat £2.00
Second Tbl
ProductID CustomerID IndivPrice
1 teste £0.50
2 othercustomer £2.50
3 teste £4.50
What I want in the results is:
ProductID ProductName TradePrice IndivPrice CustomerID (PLCustomerID)
1 Jumper £1.00 £0.50 teste
2 Jeans £3.00
3 Shoes £5.00 £4.50 teste
4 Hat £2.00
See? - The 2nd product should not get an indiv price as although it's in that second tbl, the customerID assigned to it is different. The 4th product should not get an indiv price as it's not in that second tbl at all.
however, with my query above I'd only get Products 1and 3... and if I did a query on a customer with no indiv prices I'd only get product 4 as it's not in the indiv at all...
HELP!!!!!
View 11 Replies
View Related
May 2, 2008
I am having problem with Inner joining of tables
my query is..
Select j.jobSubject,e.eOrganization ,jv.JobClick,j.jobID from dbo.tbl_Jobs jinner join dbo.tbl_Employer e on e.mId=j.jobCreatedByIDinner join dbo.tbl_JobView jv on jv.JobID=j.jobID
order by jv.JobClick desc This query returns 1 to many records
But I need the query should return 0 to many record . .yes I have already know inner join does not handle my problem so plz suggest me which type of join would solve my problem
View 3 Replies
View Related
Apr 23, 2015
I am new to SQL but trying to do join a few tables to get result showing showing one row per unique record.
Tables include:-
1. REQ
2. RFQ
3. PO
4. DOCUMENT (contains LAST_DOCUMENT_STATUS, DOCUMENT_ID, DOCUMENT_NUMBER, for example, REQ_CANCELLED, REQ_ID, REQ_NO)
5. DOCUMENT_STATUS (contains status of document, REQ_CREATE)
6. DOCUMENT_TRAIL (contains link between documents, PARENT_DOCUMENT, CURRENT_DOCUMENT, for example, REQ_ID (PARENT_DOCUMENT), RFQ_ID (CURRENT_DOCUMENT)
7. PO_REVISION (contains PO REVISION, when link with DOCUMENT, PO_REV_NO)
Currently when i tried to join all the TABLES, i get multiple lines against REQ_NO.
I realised the multiple lines generated due to the following:-
One to many relationships:
A. RFQ - 1 or more PO
B. PO - 1 or more PO_REVISON
I was thinking how to MAX the records in PO to show only the last PO_REVISION. It seems that DOCUMENT_TRAIL will contain 1 base document PO and 1 or more PO_REVISION.
View 13 Replies
View Related
Nov 6, 2014
in my table i ve the column of item code which contains '1000' ,'2000' ,'3000' series i jus wanna display the output of item codes '1000','2000'series and some of ('3000019','3000020','3000077','3000078').
i tried in my join query
these code left(itemcode,4) in ('1000','2000') or itemcode in ('3000019','3000020','3000077','3000078')
its taking so much of time how t o solve ?
View 1 Replies
View Related
Aug 12, 2015
I have configured master data services in my DB server and when i am going to explorer the entities and respected data by using navigating as below
[URL] -->Click to ExplorerÂ

I am able to select  data for only one default entity, in entities drop down is getting hidden back side , please find below snap to clearance.
Â
Note: I am using Internet explorer (11.0.9600.17239) to browse the solution.
View 2 Replies
View Related
Oct 22, 2015
I have a simple table data i want want to show row data in to column data.
     Â
SELECT clblcode,mlblmsg
FROM warninglabels
My expected result will beÂ
0001Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 0002Â 0003Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 0004
-------Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ------- --------Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â --------
May Cause....       Important..... Take madi...........         Do Not Take.......
View 16 Replies
View Related
Dec 12, 2007
Hi all experts,
I have a result set like:
Project
Milestone
Info
Project1
M1
Info1
Project1
M1
Info2
Project1
M2
Info3
Project2
M1
Info4
Project2
M2
Info5
Project3
M1
Info6
I need to create a report like:
M1
M2
Project1
Info1
Info2
Info3
Project2
Info4
Info5
Project3
Info6
But while I use matrix to build this report, I got the result like:
M1
M2
Project1
Info1
Info3
Project2
Info4
Info5
Project3
Info6
The report will not show the multiple records on the row group "Project" like item "Info2".
After I referred to the similar problem mentioned on this forums, I tried to use "RowNumber("Matrix1_Project")" to resolve it. But still I got the result like:
M1
M2
Project1
RowNumer
Info1
RowNumer
Info1
RowNumer
Info3
Project2
RowNumer
Info4
RowNumer
Info5
Project3
RowNumer
Info6
It would be much appreciated if anyone could give me some hints to complete the report I need.
Thanks in advance,
Steve Wang 2007/12/12
View 5 Replies
View Related
May 30, 2014
i am trying to configure data collector on my server. so i configured data collector on server A and setup on server B. but the "Query statistics collection set" do not show me any data.
i right click and select "collect and upload now " item and get success result for this. but in the report i cant see any data...
also in the log page of data collection i see so many errors with messages like this:
"Failed to create kernel event for collection set: {2DC02BD6-E230-4C05-8516-4E8C0EF21F95}. Inner Error ------------------> Cannot create a file when that file already exists."
i tried some solution like disabling and enabling again, re-configuring, removing and configuring again .... but none of them work right.
View 2 Replies
View Related
Jan 10, 2007
is have this code, and i know that i have a record with the ID=1 but it will not show the data from the record..<asp:Content ID="Main" ContentPlaceHolderID="ContentPlaceHolderMain" Runat="Server">
<asp:FormView ID="form1" runat="server" DataSourceID="SqlDataSource1"></asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnStrAccess %>"
SelectCommand="SELECT [MainID], [MainText] FROM [SiteText] WHERE ([MainID] = ?)" ProviderName="<%$ ConnectionStrings:ConnStrAccess.ProviderName %>">
<SelectParameters>
<asp:SessionParameter DefaultValue="1" Name="SiteMainID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</asp:Content> Why can't it show the record !??
View 2 Replies
View Related
Nov 7, 2006
Hello All,
I am using the folliwing sql statement:
execute whs_he_rpt_ds_summary '11/01/05', '11/30/05', '594'
It displays the headers but no information. The date range is obviously a date range and the 594 is a BranchNbr.
How do I see if there is truly any data for this date range.
TIA
Kurt
View 5 Replies
View Related
Feb 4, 2007
Hi all
I have a data base for some equipment on a few windows application forms written in vb 2005 express. eg Form1 for tools , form2 for nuts &bolts ect.
I wondered if it is it possible to set data base to open when the form loads and shows the data of that particular piece of equipment instead of always opening on equipment id number 1 for instance . For example when form3 loads ,equipment id is set to 3.
Thanks
Rob
View 1 Replies
View Related
Jan 6, 2007
HiI have this code, but i can't get it to work, and if i delete <% %> then the if statsment is not working, how do i get this code to work.
1 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionStringMain %>"
2 SelectCommand="SELECT [SiteMainID], [SiteMainText] FROM [MainSiteText] WHERE ([SiteMainID] = @SiteMainID)">
3 <% Dim pageString As String = "Def"
4 If Not (Request.QueryString("Page") Is Nothing) Then
5 pageString = Request.QueryString("Page").ToString
6 End If
7 If pageString = "Def" Then
8 %>
9 <SelectParameters>
10 <asp:Parameter DefaultValue="1" Name="SiteMainID" Type="Int32" />
11 </SelectParameters>
12 <%
13 Else
14 If pageString = "Page1" Then
15 %>
16 <SelectParameters>
17 <asp:Parameter DefaultValue="2" Name="SiteMainID" Type="Int32" />
18 </SelectParameters>
19 <%
20 Else
21 If pageString = "Page2" Then
22 %>
23 <SelectParameters>
24 <asp:Parameter DefaultValue="3" Name="SiteMainID" Type="Int32" />
25 </SelectParameters>
26 <%
27
28 End If
29 End If
30 %>
31 </asp:SqlDataSource>
View 5 Replies
View Related
Feb 1, 2015
I have a table i need to show data according to id. distinct id and all name should be comma separated against each id.
DECLARE @TBL TABLE (ID NUMERIC(10), NAME VARCHAR(10))
INSERT INTO @TBL (ID,NAME)
VALUES(1, 'A'), (1,'B') ,(1,'C') ,(2,'E') ,(2,'B') , (3,'F') , (3,'G')
output :
id name
1 a,b,c
2 e,b
3 f,g
View 2 Replies
View Related
Jan 21, 2008
I'm hoping this is fairly simple to do.
I have a report with many matrices. Basically what I want to do is display a message such as "No History within Date Range Selected" if there is no data on the report (all of the matrices return no data).
Is there a way to determine if the report is returning no data and show a textbox message in that case?
View 1 Replies
View Related
Nov 30, 2007
Hi to all
How do I can to show all data group by for one row using a matrix? Example:
Title ID
Harry Potter 0001
0002
0052
0120
Shrek 0003
0004
0050
Sorry for the English, I'm Brazilian.
Thank's for all
View 2 Replies
View Related
Jul 18, 2006
Hi all,
I have a recurrent problem with Data Viewers, it happens quite often that the Data Viewer does not shows any data altought I can see that some rows have passed through as there is a "XX Rows" on the data path where the Data Viewer has been added.
Sometimes it shows up sometimes not, I can't figure out why.
Any idea ?
View 2 Replies
View Related
Jan 18, 2003
Hi,
I use MSsql server 2000 and analysis service for create cube.But when I drilldown many Dimension on Analysis manager it can not show all level.
If I drilldown some level it can show data but when I drilldown many level so it have many row (I test about 60,000) it can not show result.
How can I show all result in Analysis manager or other tool ?
Thank you :D
View 1 Replies
View Related
May 21, 2006
SqlCeConnection cn = new SqlCeConnection("Data Source=\Program Files\test\tel.sdf");
try
{
SqlCeCommand cmd = cn.CreateCommand();
cmd.CommandText = "SELECT * from phone where PhoneNo = '0912312345'";
SqlCeDataAdapter adp = new SqlCeDataAdapter(cmd);
DataSet ds = new DataSet();
adp.Fill(ds);
this.dataGrid1.DataSource = ds.Tables[0];
label1.Text =Convert.ToString(????????????);
label2.Text =Convert.ToString(????????????);
}
finally
{
if (cn.State != ConnectionState.Closed)
{
cn.Close();
}
}
I can show the result in the DataGrid1
however, I want the label1 to show the Name,
and label2 to show the phoneNo.
how to do in here,
label1.Text =Convert.ToString(????????????);
label2.Text =Convert.ToString(????????????);
thanks
View 1 Replies
View Related
Mar 20, 2006
I have a subreport within the details section of my main report. This is enclosed by a single group. When I preview the subreport alone, it diplays the subreport correctly with no data (meaning it still displays the header and footer without a detail section). When the subreport is run within the main report and no subreport data is returned the subreport does not show.
Based on other threads I understand that the default functionality is to display headers and footers when no data is returned. This appears accurate except on a subreport.
View 4 Replies
View Related
Jan 12, 2007
Hi,
i have a matrix with some fixed columns. when the fixed columns have repeated data, the repeated data is hidden.
how do you show the data all the time??
eg. i have:
Customer - Month - bikes - balls - toys - Total
Sam - January - 0 - 4 - 10 - 14
- February - 3 - 2 - 8 - 13
- March - 2 - 0 - 9 - 11
Tom - January - 2 - 5 - 2 - 9
- February - 5 - 2 - 8 - 15
- March - 1 - 6 - 3 - 10
but i want it to show like this:
Customer - Month - bikes - balls - toys - Total
Sam - January - 0 - 4 - 10 - 14
Sam - February - 3 - 2 - 8 - 13
Sam - March - 2 - 0 - 9 - 11
Tom - January - 2 - 5 - 2 - 9
Tom - February - 5 - 2 - 8 - 15
Tom - March - 1 - 6 - 3 - 10
Thanks.
View 3 Replies
View Related
Feb 5, 2007
Hi
I have a database details veiw on my vb 2005 express form.
When I run my program , all the data in row 1 automatically shows up, as the default.
How can I set the default to show the data from row 2 when I start up my program?
Thanks
Rob
View 2 Replies
View Related
May 8, 2007
Hello everybody,
I have a matric that looks like this :
SALES RETURNS
Client1 100 50
Client2 40 0
But when there is no returns in the month, the column returns isn't displayed. So I get this:
SALES
Client1 100
Client2 40
How can I show this column even with empty data?
Thanks in advance for your help.
Zoz
View 5 Replies
View Related
Jan 16, 2008
Hello i am doing my final project in my University and i have chosen to do a beta my university portal.I am facing a problem because i don't know how to link students with his specific data when he logs in to the site for example i want to show his specific grades when he logs in or anything else that is related to himand this is what i am using to show the grades with the use of data grid 1 SELECT Student.StudentiId, Student.StudentName, Student.StudentSurname, Course.Course, Exams.Datewritten, Exam.Exam, Exams.Grade2 FROM Student 3 INNER JOIN 4 Exams 5 ON Student.StudentiId = Exams.Studentid 6 INNER JOIN 7 Course 8 ON Exams.Courseid = Course.Courseid 9 INNER JOIN10 Exam 11 ON Exams.Examid = Exam.Examid; I am very confused since i dunno how to do thisShould i need to relate the asp.net membership database with mine?P.S my vb.net skills are low Here is my database Schema
View 8 Replies
View Related
Mar 4, 2004
Hi Guys,
I've been strugling with this problem all morning today.
Basically I store images in SQL Server 2000 database and then whould like to show them with
<img src="viewImage.aspx?image_id=10" border=1>
My table structure is setup this way
TABLE [userImages] (
[imageFilename] [nvarchar] (128) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[imageContentType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[imageFileSize] [bigint] NULL ,
[imageFileImage] [image] NULL )
and in viewImage.aspx I have:
if (dr.Read())
{
Response.ContentType = dr.GetString(dr.GetOrdinal("imageContentType"));
Response.BinaryWrite( (byte[]) dr["imageFileImage"] );
}
I have no prolems retrieving the data from DB. But the image does not display(in IE it shows a broken link image)
What's even more puzzling is I CAN display the same image from HDD like so:
FileStream fs = File.OpenRead("D:\my_image.png");
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
fs.Close();
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(buffer);
Am I missing something very obvious. I tried playing around with different ContentType's same result.
In my case I am forced to store images in the DB.
I've seen other examples on the net and theirs work. Please help.
Sincerely,
Vlad Orlovsky
View 1 Replies
View Related
Jun 27, 2014
I have a table history of Employee data.
id | EmpNo | EmpName | MobileNo | Email | EmpSSS | UpdateDate | UpdateUser
I have to make a stored procedure that will show the history and changes made to a given EmpNo, with the UpdateDate, UpdateUser and indicate which field is modified. Ex. Employee Mobile number was changed from '134151235' to '23523657'.
Result must be:
EmpNo | UpdateDate | UpdateUser | Field changed | Change from | change to
View 4 Replies
View Related
May 1, 2008
I have used two matrix in one of my reports. One matrix is right above other. Both matrix's columns are allocated for month name. I.e there are 12 columns for each month of the year for each matrix.
column name of the second matrix was hidden. so end user can see only first matrix column name and corresponding data in each matrix.
But the problem is now, when there is no data for perticular month in first matrix, thats month's column does not appear at all.
Lets say there is no data for November in first matrix. so Novem column is missing in first mtrix now. but still Novem column is shown on the second matrix as it has some data, although column name is not shown. I wonder how I can show all the columns of both matrix regardless of population of data.
Thanks
View 1 Replies
View Related
Jul 22, 2015
I have a powerpivot table which groups customers into ranges of sales figures. When I use a slicer to slice by region, I lose some of the ranges because they contain no data. I need them to show up even if there is no data. I've checked all of the boxes to "Show items with no data on columns (and Rows). But this has no effect. I created a measure using the following formula which also has no effect.
NeverBlankAcct:=IF(ISBLANK(Count([CACCT])),0,Count([CACCT]))
View 13 Replies
View Related
Nov 14, 2007
Can we show the data of a report for previous month? The report is supposed to run montly basis. But once it is run, it shows the data only for the previous month.
we can show it if its only for previous day. In this case it is like this;
cdtable.SubmittedDate = GETDATE () - 1
But I dont find function like GETMONTH() or smthing.
Thanks
View 1 Replies
View Related
Nov 14, 2007
hi,
Can we show the data of a report for previous month? The report is supposed to run montly basis. But once it is run, it shows the data only for the previous month.
we can show it if its only for previous day. In this case it is like this;
cdtable.SubmittedDate = GETDATE () - 1
But I dont find function like GETMONTH() or smthing.
Thanks
View 3 Replies
View Related
Oct 19, 2006
I've installed SQL Express SP1 on a Windows 2003 server and I'm trying to get a new MySQL datasource to be recognized in the DTSWizard. A MySQL database needs to be moved over to a MS SQL server due to software requirements (which weren't looked at before the site was created). I've installed the ODBC Connector/MySQL software and created the System DSN (named "MySQL DB Import) in the Administrative Tools/Data Sources (ODBC) tool. When I start up the DTS wizard for SQL Express however, I do not get my new data source in the selection options for data sources. I am following the instructions on this page: http://www.microsoft.com/technet/prodtechnol/sql/2000/deploy/mysql.mspx#ERJAE What am I missing?
View 2 Replies
View Related
May 16, 2008
On my Home page I have a gridview that has Four columns: CustomerID, Product, Quantity, then a link (which appears on each row..called View). When a user clicks View on a particular row it will then send that particular CustomerID to the next page (CustomerProfile.aspx).
On the CustomerProfile.aspx page I have a textbox where the Customer Name should appear. How do I go about displaying the customer name in the textbox based on the CustomerID passed to the customerprofile.aspx page? Do I need to call a stored procedure? Do i need to call the Customer Table in my code?
(i'm using C#) Thanks!! Ur help is very much appreciated!
Side Note: i am passing the CustomerID by a SESSION variable called customerID ~~~>this is in my pageLoad method labelCustomerID.Text = Session["customerID"].ToString();
but i'm wanting to have the Customer Name in a textbox based on the above ^^^ session variable. My textbox is called txtCustomerName.Text
*** Customer Table***CustomerIDCustomerNameCustomerAddress
^^^wanting to call the customer name and put it in the customer name text box based on the particular customerID
View 22 Replies
View Related