(Type your message here)
--------------------------------
From: dim mzeura
I have the same problem too. Please help!
System.Data.Ole Db.OleDbExcepti on: Syntax error (missing operator) in query expression ''\\crwfs1\proj ects12\AP-Wilbur\Analysis _NonQuantitativ e\Damages_Repor t\Backup_Exhibi ts_Leitzinger's _Damages_Calcul ations', '328424' )'.
-----Here is my code----
<html><head>
<title>Director y Information</title>
<%@ Page Language="vb" debug="true"%>
<%@ Import Namespace="Syst em.IO" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDB" %>
<script runat="server">
dim intTotalDirSize as Long
Sub Page_Load(sende r as object, e as EventArgs)
dim strRootDir as string = "\\crwfs1\proje cts12" 'Form variable or add the physical path of your directory here
Response.write (" <b>Directorie s in</b> " & strRootDir & "<hr> <br>") 'List the files in the root directory
ListFiles(strRo otDir)
ListDirs(strRoo tDir, strRootDir) 'List subdirectories and their files
end sub
Sub ListDirs(strCur rentDir as string, strRootDir as string)
dim strDir as string
dim arrSubdirs() as string
arrSubdirs = Directory.GetDi rectories(strCu rrentDir)
for each strDir in arrSubdirs
ListFiles(strDi r)
ListDirs(strDir , strCurrentDir) 'Recursively call each subdirectory
next
end sub
Sub ListFiles(strCu rrentDir as string)
Dim dir as DirectoryInfo
dir = new DirectoryInfo(s trCurrentDir)
Dim arrFiles as Array = dir.GetFiles()
Dim strFile as FileInfo
dim intDirsize as Long
For each strFile in arrFiles
'response.write ( " &n bsp; " & strFile.Name)
'response.write ( " &nbs p;" & strFile.Length & " bytes <br>")
intDirSize += strFile.length
next
Dim conNorthwind as OleDBConnection
Dim strInsert As String
Dim strInsert2 As String
Dim cmdInsert As OleDbCommand
Dim cmdInsert2 As OleDbCommand
conNorthwind = New OleDBConnection ("PROVIDER=Micr osoft.Jet.OLEDB .4.0;DATA Source=" & server.MapPath( "db.mdb"))
strInsert = "Insert INTO Dir ( Directory,Sze ) VALUES ( '" & strCurrentDir & "', '" & intDirSize & "' )"
cmdInsert = New OleDBCommand ( strInsert, conNorthwind )
conNorthwind.Op en()
cmdInsert.Execu teNonQuery()
conNorthwind.Cl ose()
intTotalDirSize += intDirSize
end Sub
</script>
</head>
</html>
---------End of Code--------------
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>NgMJZ2Z1n0G zljCVvaX0HA==</Id>