I am trying to execute a make table query in my vb.net program. The db that
I am accessing is an Access 2000 format db. The SQL code that I am using has
been cut and pasted from the SQL View having designed the query in the
design view of Access.
The code in question is below, I apologise for the length of the SQL
statement
Dim SqlComText As String = "SELECT TblCentreSessio n.ID,
TblCentreSessio n.Session AS [SessionID], TblSession.Sess ionYear AS [Session
Year], TblSession.Sess ionSeason AS [Session Season], TblCentre.Centr eName AS
[Centre Name], TblExaminer.Exa minerCode AS [Examiner Code],
TblExaminer.Exa minerSName AS [Examiner Surname], TblExaminer.Exa minerMName
AS [Examiner Middle Name], TblExaminer.Exa minerFName AS [Examiner First
Name], TblSyllabus.Syl labusName AS [Syllabus Name],
CLng([TblCandidate].[CandidateID]) AS [Candidate ID], TblCandidate.SN ame AS
[Candidate Surname], TblCandidate.MN ame AS [Candidate Middle Name],
TblCandidate.FN ame AS [Candidate First Name], CLng([TblSubject].[SubjectID])
AS [Subject ID], TblSubject.Subj ectName AS [Subject Name],
CLng([TblGrade].[GradeID]) AS [Grade ID], TblGrade.GradeN ame AS [Grade
Name], TblExamResults. Result, TblExamResults. AdjResult1 AS [Adjusted Result
1], TblExamResults. AdjResult2 AS [Adjusted Result 2], tblNote.Notes AS
[Adjustment Notes] INTO [Results Table] IN '" & ChosenFilename & "' FROM
tblNote RIGHT JOIN (((((TblCentreS ession LEFT JOIN TblCentre ON
TblCentreSessio n.Centre = TblCentre.Centr eCode) LEFT JOIN TblSession ON
TblCentreSessio n.Session = TblSession.Sess ionID) LEFT JOIN TblSyllabus ON
TblCentreSessio n.Syllabus = TblSyllabus.Syl labusID) LEFT JOIN TblExaminer ON
TblCentreSessio n.Examiner = TblExaminer.Exa minerCode) RIGHT JOIN
(((TblCandidate RIGHT JOIN TblExamResults ON TblCandidate.Ca ndidateID =
TblExamResults. CandidateID) LEFT JOIN TblSubject ON TblExamResults. Subject =
TblSubject.Subj ectID) LEFT JOIN TblGrade ON TblExamResults. Grade =
TblGrade.GradeI D) ON TblCentreSessio n.ID = TblExamResults. CentreSession) ON
tblNote.ExamID = TblExamResults. ID WHERE (((TblCentreSes sion.Session)=" &
chosenSessionID & ") AND ((TblExamResult s.Result) Is Not Null And
(TblExamResults .Result)>0)) ORDER BY TblCentreSessio n.ID"
Dim cnn1 As New OleDb.OleDbConn ection("Provide r=Microsoft.Jet .OLEDB.4.0;Jet
OLEDB:System Database=" & systemdblocatio n & ";Data Source=" &
examdblocation & ";User ID=" & User & ";Password= " & PWord)
Dim cmd1 As New OleDb.OleDbComm and
cnn1.Open()
Dim runningcount As Integer = 0
Try
With cmd1
.Connection = cnn1
.CommandText = SqlComText
.ExecuteScalar( )
End With
Catch ex As Exception
MsgBox(ex.ToStr ing)
End Try
cnn1.Close()
I have tried executing it but each time I get the following error:
"System.Data.Ol eDb.OleDbExcept ion: IErrorInfo.GetD escription failed with
E_FAIL(0x800040 05).
at System.Data.Ole Db.OleDbCommand .ExecuteCommand TextErrorHandli ng(Int32
hr)
at
System.Data.Ole Db.OleDbCommand .ExecuteCommand TextForSingleRe sult(tagDBPARAM S
dbParams, Object& executeResult)
at System.Data.Ole Db.OleDbCommand .ExecuteCommand Text(Object&
executeResult)
at System.Data.Ole Db.OleDbCommand .ExecuteCommand (CommandBehavio r
behavior, Object& executeResult)
at System.Data.Ole Db.OleDbCommand .ExecuteReaderI nternal(Command Behavior
behavior, String method)
at System.Data.Ole Db.OleDbCommand .ExecuteScalar( )
at MYDB.ExportForm .btnExport_Clic k(Object sender, EventArgs e) in
C:\Documents and Settings\Admini strator\My Documents\Visua l Studio
Projects\myDB\m yDB\ExportForm. vb:line 146;"
Any help in understanding what I am doing wrong, or instructions on how to
do this better would me greatly appreciated.
Nov 20 '05
20 5224
Peter,
Great.
As I have said that in this thread I hate SQL and this is one of the
reasons, so many impossible reserved words
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kulnor |
last post by:
My hosting company upgraded yesterday to pHp 4.3.10. Since then, all my
INSERT/UPDATE/DELET query on our MS-SQL database seem to fail. No
specific error message is returned by mssql_get_last_message(). The
SELECT statements work fine.
If I test on my local server running 4.3.9 the application behaves
properly. Any suggestion/idea?
thanks
|
by: Not Me |
last post by:
Hi,
I have a stored procedure, that works perfectly when run from the query
analyser, however if I run it through access vba, (using exec) I get a
runtime error 208: invalid object name '#tmpContact'.
Any ideas why this happens? The temporary table #tmpContact is used in
the procedure, but as I say, it all works fine from the analyser.
Thanks,
|
by: js |
last post by:
I am using SQL Server 2000. I am getting the following error when
executing the following query. The query joins a view
.dbx.dbo.vwreports that resides on a linked server. I can sort
on fields on D table or R view individually, but some fields take a
long time to sort even they are on non-cluster indexes. I can not sort
on any field in table E, K, and L at all. Also I tried to save this
query as a view in the local server. SQL Server...
|
by: Davy Faassen |
last post by:
Hi,
In the CLI guide and reference i've read about the possibility of getting status
information when using arrays to input parameter values. This i've achieved as
described with the SQL_ATTR_PARAM_STATUS_PTR attribute of the SQLSetStmtAttr()
function.
I'm trying to do a bulk INSERT and if there are already records in the target
table, i want to update those records that were already present. Depending on
the status information just...
|
by: Neil Hindry |
last post by:
I wonder if you can help me.
I have setup an address-book database in Access XP. I have the first name &
surname as separate fields. As I wanted to sort my database by surname and
then by first name I had surname before first name when I created the
fields of my database..
To do the sort (in table view) I highlighted the two columns (fields), in
this case surname and first name, and selected sort. Access then sorted the
database by...
| |
by: Neil Robbins |
last post by:
I am trying to execute a make table query in my vb.net program. The db that
I am accessing is an Access 2000 format db. The SQL code that I am using has
been cut and pasted from the SQL View having designed the query in the
design view of Access.
The code in question is below, I apologise for the length of the SQL
statement
Dim SqlComText As String = "SELECT TblCentreSession.ID,
TblCentreSession.Session AS , TblSession.SessionYear AS...
|
by: Not4u |
last post by:
Hello
Config : SQL 2000 on WIN 2000 (IIS 5.0)
In my ASP page for some queries i have this error :
Microsoft OLE DB Provider for SQL Server error '80040e31'
Timeout expired
|
by: Daz |
last post by:
Hi everyone.
I was faced with the choice of whether my problem is indeed a PHP
problem or a MySQL. I have decided it's a PHP problem as I don't
experience the same problem when I execute the same query at the CLI.
I am having trouble executing a large query through my PHP script. It
takes about 7-11 seconds on
average to execute, whereas the same query only takes 0.01 seconds to
execute through the CLI.
|
by: raghuvendra |
last post by:
Hi
I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button.
All these are aligned in a row. And Each Category Name has its corresponding Category order, Input field and a submit button.
The Category name is being fetched from the oracle db along with the corresponding Category order.
In the corresponding input field (text box) the user enters a new category order which gets stored in the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |