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. 20 5224
Hi Neil,
First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you execute a SQL statement
against a Access 2000 database, you got error.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.
Can you post the exact error message when the error occurs?
Also you may try to run the SQL statement in Access directly to see what
you will get.
Please apply my suggestion above and let me know if it helps resolve your
problem.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Neil,
First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you execute a SQL statement
against a Access 2000 database, you got error.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.
Can you post the exact error message when the error occurs?
Also you may try to run the SQL statement in Access directly to see what
you will get.
Please apply my suggestion above and let me know if it helps resolve your
problem.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Hi Neil,
What you try to archieve, you want to select something however it stays
nowhere.
And than when you try things the first time, start with a simple select as
"Select * from mytable.
Also I saw you took this direct form a sample on msdn.
I think it is a very old sample.
In my opinion you want to do somenting as
myaggregateValu e = myCommand.Execu teScalar()
However I am in doubt if this is what you want, so tell what you want to
archieve
Cor
Hi Neil,
What you try to archieve, you want to select something however it stays
nowhere.
And than when you try things the first time, start with a simple select as
"Select * from mytable.
Also I saw you took this direct form a sample on msdn.
I think it is a very old sample.
In my opinion you want to do somenting as
myaggregateValu e = myCommand.Execu teScalar()
However I am in doubt if this is what you want, so tell what you want to
archieve
Cor
Hi Peter, Can you post the exact error message when the error occurs?
I thought he did I copied it for you, see below.
Cor
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;"
Hi Peter, Can you post the exact error message when the error occurs?
I thought he did I copied it for you, see below.
Cor
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;"
Hi Peter & Cor,
Thanks for the responses. That is the exact error message that Cor has
copied in the preceeding message. Your understanding seems correct to me
Peter. I am executing a SQL make table query statement and I get the error
message on the line '.ExecuteScalar ()'. I have also tried using
'.ExecuteNonQue ry' but I get the exact same error. The purpose of what I am
trying is to create a table that brings together data from a number of other
tables in the db and to then put this in a new database with a name of the
users choosing and at a location of the users choosing. Effectively to
export the data.
Any help is always much appreciated,
Regards,
Neil R.
Hi Peter & Cor,
Thanks for the responses. That is the exact error message that Cor has
copied in the preceeding message. Your understanding seems correct to me
Peter. I am executing a SQL make table query statement and I get the error
message on the line '.ExecuteScalar ()'. I have also tried using
'.ExecuteNonQue ry' but I get the exact same error. The purpose of what I am
trying is to create a table that brings together data from a number of other
tables in the db and to then put this in a new database with a name of the
users choosing and at a location of the users choosing. Effectively to
export the data.
Any help is always much appreciated,
Regards,
Neil R.
Hi Neil,
I understand now what you want to do, however I hate SQL.
I do not know how deep Peters knowledge is of that, however meanwhile you
can try to see if you get more information by setting this before the catch
ex as exception (you can let that stay)
\\\
Catch sqlEx As SqlException
MessageBox.Show (sqlEx.ToString )
Catch ex as Exception
.......
End try
///
Maybe you get than some better information.
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: 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...
| |