S
Saber
I've two queries in MS-Access, named "Archive" and "final", how can I excute
them?
perhaps it helps:
----Archive Query------------------------------
SELECT LAST(a.id) AS PostID, LAST(a.posttitle) AS PostTitle,
LAST(a.posttext) AS PostText, LAST(a.posttype) AS PostType, LAST(a.postdate)
AS PostDate, LAST(a.posttopic) AS PostTopic, LAST(a.authorid) AS AuthorID
FROM tblPosts AS a INNER JOIN tblPosts AS b ON a.id<=b.id
GROUP BY a.id
HAVING COUNT(*) Between 5 And 10;
---------------------------------^------^^------
----final Query---------------------------------
SELECT Archive.*, tblAuthors.*
FROM Archive INNER JOIN tblAuthors ON Archive.AuthorID=tblAuthors.ID;
------------------------------------------------
one more thing: I want to send variables instead of 5,10 in first query. It
is easy if I want just excute first query, but I want to excute both.
I pass strSql to a function: showRpt(dtrWeblog, rptWeblog, strSql)
Sub showRpt(ByVal dtr As OleDbDataReader, ByVal rpt As Repeater, ByVal str
As String)
cmdSqlWeblog = New OleDbCommand(str, con)
ConnectDB(con)
dtr = cmdSqlWeblog.ExecuteReader
rpt.DataSource = dtr
rpt.DataBind()
dtr.Close()
DisconnectDB(con)
cmdSqlWeblog.Dispose()
End Sub
Thanks in advance
them?
perhaps it helps:
----Archive Query------------------------------
SELECT LAST(a.id) AS PostID, LAST(a.posttitle) AS PostTitle,
LAST(a.posttext) AS PostText, LAST(a.posttype) AS PostType, LAST(a.postdate)
AS PostDate, LAST(a.posttopic) AS PostTopic, LAST(a.authorid) AS AuthorID
FROM tblPosts AS a INNER JOIN tblPosts AS b ON a.id<=b.id
GROUP BY a.id
HAVING COUNT(*) Between 5 And 10;
---------------------------------^------^^------
----final Query---------------------------------
SELECT Archive.*, tblAuthors.*
FROM Archive INNER JOIN tblAuthors ON Archive.AuthorID=tblAuthors.ID;
------------------------------------------------
one more thing: I want to send variables instead of 5,10 in first query. It
is easy if I want just excute first query, but I want to excute both.
I pass strSql to a function: showRpt(dtrWeblog, rptWeblog, strSql)
Sub showRpt(ByVal dtr As OleDbDataReader, ByVal rpt As Repeater, ByVal str
As String)
cmdSqlWeblog = New OleDbCommand(str, con)
ConnectDB(con)
dtr = cmdSqlWeblog.ExecuteReader
rpt.DataSource = dtr
rpt.DataBind()
dtr.Close()
DisconnectDB(con)
cmdSqlWeblog.Dispose()
End Sub
Thanks in advance