Database File Logging

Results 1 to 2 of 2

Thread: Database File Logging

  1. #1
    Join Date
    Dec 1969

    Default Database File Logging

    I am using a file upload script to upload files to a server and put information about the file in a database table.<BR>The problem is if a file is uploaded again there then becomes 2 records for that file in the database. What I have tried is a subroutine to check if a record already exists in the database for that filename - and if so to change its status to overwritten rather than delete the row (for audit trail purposes). Can anyone suggest why the following script is not doing the job?<BR><BR>
    <BR>Sub CheckDoesRowExist(FileNameRequest As String)<BR>	<BR>	SelectStatement = "SELECT * FROM Documents WHERE FileName = "& FileNameRequest & " AND (ViewType &#060;&#062; &#039;overwritten&#039; AND ViewType &#060;&#062; &#039;erased&#039;) "<BR>	ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="& Server.MapPath("..database.mdb")				<BR>	Connect.ConnectionString = ConnectString<BR>	Adapter.SelectCommand = New OleDbCommand(SelectStatement, Connect)<BR>	ExistCB = new OleDbCommandBuilder(Adapter)<BR>	Adapter.Fill(ExistDS,"Documents")<BR>	<BR>	If ExistDS.Tables("Documents").Rows.Count &#062; 0 Then<BR>		Row = ExistDS.Tables("Documents").Rows(0)<BR>		Row.Item("ViewType") = "overwritten"<BR>		Adapter.Update(ExistDS,"Documents")<BR>	End If<BR>	<BR>End Sub<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Database File Logging

    Looks to me like you need to enclose your filename in the SQL query with apostrophes (as you are for the other strings).<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts