|
-
Mar 11th, 2010, 11:08 AM
#1
Thread Starter
Frenzied Member
Why Do I Get This Error???
Hi Peeps,
I have the following code:-
Code:
sSQL = "SELECT * FROM FILESTRUCTURE"
oleDAFiles = New OleDb.OleDbDataAdapter
oleDAFiles.SelectCommand = New OleDb.OleDbCommand(sSQL, oleDCData)
oleDSFiles = New DataSet
oleDAFiles.Fill(oleDSFiles, "FILESTRUCTURE")
For iRowCount = 0 To oleDSFiles.Tables(0).Rows.Count - 1
oleDSFiles.Tables(0).Rows(iRowCount).Delete()
oleCBFiles = New OleDb.OleDbCommandBuilder(oleDAFiles)
oleDAFiles.Update(oleDSFiles, "FILESTRUCTURE")
Next
On the update I get a syntax error and do not no why?????
Thanks for any help,
Jiggy!
-
Mar 11th, 2010, 11:26 AM
#2
Thread Starter
Frenzied Member
Re: Why Do I Get This Error???
Sorry the syntax error is:-
Code:
"Syntax error (missing operator) in query expression '((REFNO = ?) AND ((? = 1 AND PATH IS NULL) OR (PATH = ?)) AND ((? = 1 AND FTPPATH IS NULL) OR (FTPPATH = ?)) AND ((? = 1 AND FILENAME IS NULL) OR (FILENAME = ?)) AND ((? = 1 AND MODIFIEDDATETIME IS NULL) OR (MODIFIEDDATETIME = ?)) AND ((? = 1 AND TRANSFER'."
-
Mar 11th, 2010, 11:37 AM
#3
Re: Why Do I Get This Error???
What is the value of oleDCData?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Mar 11th, 2010, 12:14 PM
#4
Thread Starter
Frenzied Member
Re: Why Do I Get This Error???
Code:
Public oleDCData As OleDb.OleDbConnection
-
Mar 11th, 2010, 12:24 PM
#5
Re: Why Do I Get This Error???
Show me the connection string...
Also if you can include the complete code in that sub, I will go through it in one go..
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Mar 11th, 2010, 04:33 PM
#6
Thread Starter
Frenzied Member
Re: Why Do I Get This Error???
Thank u for your help; here is my code:-
Code:
Private Sub CreateNewDatabase(ByVal sPath As String)
Dim oleDAFiles As OleDbDataAdapter
Dim oleDSFiles As DataSet
Dim oleDRFiles As DataRow
Dim oleCBFiles As OleDbCommandBuilder
Dim sFileStructure As String
Dim iLoop As Int16
Dim sSQL As String
sSQL = "SELECT * FROM FILESTRUCTURE"
oleDAFiles = New OleDb.OleDbDataAdapter
oleDAFiles.SelectCommand = New OleDb.OleDbCommand(sSQL, oleDCData)
oleDSFiles = New DataSet
oleDAFiles.Fill(oleDSFiles, "FILESTRUCTURE")
iFileCount = -1
sFileStructure = Dir(sPath & "\*.*", FileAttribute.Directory)
While sFileStructure <> ""
iFileCount = iFileCount + 1
If sFileStructure <> "" And sFileStructure <> "." And sFileStructure <> ".." Then
If (GetAttr(sPath & sFileStructure) And vbDirectory) = FileAttribute.Directory Then
iArrayPosition = iArrayPosition + 1
iFilePosition(iArrayPosition) = iFileCount
Call CreateNewDatabase(sPath & sFileStructure)
sFileStructure = Dir(sPath & "\*.*", FileAttribute.Directory)
iFileCount = 0
For iLoop = 0 To iFilePosition(iArrayPosition) - 1
sFileStructure = Dir()
iFileCount = iFileCount + 1
Next
iArrayPosition = iArrayPosition - 1
Else
If UCase$(sFileStructure) <> "FTPSERVER.LDB" Then
oleDRFiles = oleDSFiles.Tables(0).NewRow
oleDRFiles("PATH") = "m:" & sPath.ToString.Substring(2, Len(sPath) - 2)
oleDRFiles("FTPPATH") = Mid$(sChangeSlashes(oleDRFiles("PATH")), 3, Len(oleDRFiles("PATH")) - 2)
oleDRFiles("FILENAME") = sFileStructure
oleDRFiles("MODIFIEDDATETIME") = FileDateTime(sPath & "\" & sFileStructure)
oleDSFiles.Tables(0).Rows.Add(oleDRFiles)
oleCBFiles = New OleDb.OleDbCommandBuilder(oleDAFiles)
oleDAFiles.Update(oleDSFiles, "FILESTRUCTURE")
End If
End If
End If
sFileStructure = Dir()
End While
End Sub
-
Mar 11th, 2010, 04:38 PM
#7
Re: Why Do I Get This Error???
What is the value of sPath at the time of the error?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Mar 12th, 2010, 01:39 AM
#8
Re: Why Do I Get This Error???
I think you might be chasing red herrings koolsid. The error message says that there's a syntax error in the SQL code. The most common cause of that is a query that uses a wildcard to return one or more columns whose names are reserved words or contain illegal characters. The way to fix it is to either change your column names or else escape the culprits in the query, e.g. instead of this:you do this:
SQL Code:
SELECT [Column1], [Column2] FROM MyTable
The command builder should then follow your lead and the syntax error goes away.
-
Mar 12th, 2010, 02:29 AM
#9
Re: Why Do I Get This Error???
I think you might be chasing red herrings koolsid.
Possibly Jm 
The error also mention Path error so I wanted to start off from the very start and cover every nook and corner of the code since I cannot test it.
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Mar 12th, 2010, 02:39 AM
#10
Re: Why Do I Get This Error???
 Originally Posted by koolsid
The error also mention Path error
That would be a PATH column in the database table.
-
Mar 12th, 2010, 02:50 AM
#11
Re: Why Do I Get This Error???
 Originally Posted by jmcilhinney
That would be a PATH column in the database table.
Ah! In that case I was actually chasing red herrings
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|