NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 76 77 78 79 80 … 93 Next »
SQL MS ACCESS and thos damn JOINS

 
  • 0 Vote(s) - 0 Average
SQL MS ACCESS and thos damn JOINS
joche
Offline

Member

Posts: 143
Threads: 39
Joined: Jan 2005
#1
2005-02-16, 11:51 PM
I'm trying to get a list of all recorded shows including the friendly name of the channel, I'm not extremely sucessfull. ;-)

I get an error running this:
select p.name, p.description, rs.filename, rs.manual_start_time, rs.manual_end_time, c.name
from programme as p, recording_schedule as rs
LEFT OUTER JOIN channel as c ON c.oid = rs.manual_channel_oid
where p.oid=rs.oid and rs.status=2

It says the join expression isn't supported.

And a last question, is there such a live-command window for MS-access where I can test run my queries. Now I have to run a small console application to verify my SQL syntax, very time consuming.

Thanks for all help!



KingArgyle
Offline

Posting Freak

Posts: 1,271
Threads: 95
Joined: Nov 2004
#2
2005-02-17, 12:30 AM
Try this:

Try this:

select p.name, p.description, rs.filename, rs.manual_start_time, rs.manual_end_time, c.name
from programme as p
inner join recording_schedule as rs on p.oid = rs.programme_oid
LEFT OUTER JOIN channel as c ON c.oid = rs.manual_channel_oid

As for working with Access SQL. If you have MS Access it self you can build your queries in there, and test them that way. Otherwise you haev to use an ODBC/OLEDB tool to do it.
joche
Offline

Member

Posts: 143
Threads: 39
Joined: Jan 2005
#3
2005-02-17, 12:34 AM
[b Wrote:Quote[/b] (KingArgyle @ Feb. 16 2005,19:30)]select p.name, p.description, rs.filename, rs.manual_start_time, rs.manual_end_time, c.name
from programme as p
inner join recording_schedule as rs on p.oid = rs.programme_oid
LEFT OUTER JOIN channel as c ON c.oid = rs.manual_channel_oid
Thanks for your quick reply. I'm just off to bed (it's 1.30am). Just because I probably will run into problems tomorrow when I test this, where shall I put the (equalence to) " rs.status=2 "?
jasonf
Offline

Member

Posts: 121
Threads: 7
Joined: Oct 2004
#4
2005-02-17, 12:41 AM
Your where clause would still go at the end.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">SELECT p.name, p.description, rs.filename, rs.manual_start_time, rs.manual_end_time, c.name
FROM programme as p
    INNER JOIN recording_schedule as rs ON p.oid = rs.programme_oid
    LEFT JOIN channel as c ON c.oid = rs.manual_channel_oid
WHERE rs.status = 2
[/QUOTE]
JasonF
joche
Offline

Member

Posts: 143
Threads: 39
Joined: Jan 2005
#5
2005-02-17, 03:02 PM
[b Wrote:Quote[/b] (jasonf @ Feb. 16 2005,19:41)]Your where clause would still go at the end.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">SELECT p.name, p.description, rs.filename, rs.manual_start_time, rs.manual_end_time, c.name
FROM programme as p
INNER JOIN recording_schedule as rs ON p.oid = rs.programme_oid
LEFT JOIN channel as c ON c.oid = rs.manual_channel_oid
WHERE rs.status = 2
[/QUOTE]

Thanks, unfortunately I'm still stucked:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
System.Data.OleDb.OleDbException: Syntax error (missing operator) in query expression
'p.oid = rs.programme_oid LEFT JOIN channel as c ON c.oid = rs.manual_channel_oid'.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARA
MS dbParams, Object&amp; executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&amp; executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Ob
ject&amp; executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behav
ior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader()
at ConsoleApplication1.Class1.Main(String[] args) in c:\visual studio project
[/QUOTE]



KingArgyle
Offline

Posting Freak

Posts: 1,271
Threads: 95
Joined: Nov 2004
#6
2005-02-17, 03:39 PM
What does your source code look like when you are building the SQL string to be executed?
joche
Offline

Member

Posts: 143
Threads: 39
Joined: Jan 2005
#7
2005-02-17, 04:44 PM
[b Wrote:Quote[/b] (KingArgyle @ Feb. 17 2005,10:39)]What does your source code look like when you are building the SQL string to be executed?
Ahh, a very relevant question:

This is to build the query:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> string query = " SELECT p.name, p.description, rs.filename, rs.manual_start_time, rs.manual_end_time, c.name";
query += " FROM programme as p";
query += " INNER JOIN recording_schedule as rs ON p.oid = rs.programme_oid";
query += " LEFT JOIN channel as c ON c.oid = rs.manual_channel_oid";
query += " WHERE rs.status = 2";[/QUOTE]

and below is the command:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> OleDbCommand myCommand = new OleDbCommand(query,myConnection);
myConnection.Open();
OleDbDataReader myReader = myCommand.ExecuteReader();[/QUOTE]
jasonf
Offline

Member

Posts: 121
Threads: 7
Joined: Oct 2004
#8
2005-02-17, 05:41 PM
Ah! Oh, yeah.... Access requires parens around a join set if you're going to perform additional joins.

I played around with the query in Access until it worked, and here's the SQL output:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">SELECT p.name, p.description, rs.filename, rs.manual_start_time, rs.manual_end_time, c.name
FROM (programme AS p INNER JOIN recording_schedule AS rs ON p.oid = rs.programme_oid)
LEFT JOIN channel AS c ON rs.manual_channel_oid = c.oid
WHERE (((rs.status)=2));
[/QUOTE]
JasonF
joche
Offline

Member

Posts: 143
Threads: 39
Joined: Jan 2005
#9
2005-02-17, 07:30 PM
Yes, that did it. No wonder I never succeeded during my trial and error method.

Thanks jasonf and KingArgyle for your help.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  NextPVR 5: When is PIN Required for API Access? pkscout 3 2,996 2020-05-26, 04:45 AM
Last Post: sub
  API access to artwork and deleting recordings cncb 29 16,695 2016-11-06, 02:20 AM
Last Post: mvallevand
  Access 'Stay on top' setting from a plugin? McBainUK 5 2,669 2011-11-07, 04:43 PM
Last Post: sub
  Access ImportHDPVRChannelsForm mvallevand 62 16,967 2011-08-09, 03:37 AM
Last Post: mvallevand
  Access to Schedules inside standalone progs dero 1 1,573 2008-12-09, 12:03 PM
Last Post: dero
  Linking gbpvr.db3 to Access 2003: get readonly tables Khurram 5 4,204 2008-09-11, 08:35 AM
Last Post: Khurram
  Access to FSE switch idkpmiller 12 4,693 2008-07-05, 04:01 PM
Last Post: whurlston
  Access DB and DateTime idkpmiller 5 2,648 2008-04-14, 10:37 AM
Last Post: idkpmiller
  SilverLight Web Access uwfalcon 1 1,521 2008-03-16, 05:32 AM
Last Post: sub
  GB-PVR web access McBainUK 2 3,793 2008-03-14, 03:21 PM
Last Post: McBainUK

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode