The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

xPLMediaNet - Need some .net oledb help please


  • Subject: xPLMediaNet - Need some .net oledb help please
  • From: "Tony Tofts" <tony@xxxxxxxxxx>
  • Date: Mon, 25 Jul 2005 17:37:11 +0100

Hi all,

Was wondering if anyone can tell me how to fix the code below please?

The idea is when a folder is renamed the code updates all appropriate
records in the database. But as the folder can have subfolders I can't
simply update the 'Path' field as I need to change part fields too (e.g. if
c:\MP3\Test is renamed to c:\MP3\Test2 then I need to change c:\MP3\Test\
to
c:\MP3\Test2\ and c:\MP3\Test\An Artist\ to c:\MP3\Test2\An Artist etc)

The code runs thru ok, and if I look at the value of dt.row(x).item(0) they
all change to the modified value, but I can't work out how to write it back
to the database??? The DA.Update doesn't error, but does nothing.

Any thoughts please?

Many thanks
Tony

Dim rstSELECT As New OleDbCommand
rstSELECT.Connection = dbs
rstSELECT.CommandText = "SELECT Path FROM Music WHERE Path Like
?"
rstSELECT.Parameters.Add("path", OleDbType.VarChar, 255)
rstSELECT.Parameters("path").Value = OldFullPath &
"\%"
Dim DA As OleDbDataAdapter = New OleDbDataAdapter(rstSELECT)
Dim DT As New DataTable
DA.Fill(DT)
If DT.Rows.Count = 0 Then
rstSELECT.Dispose()
Exit Sub ' nothing found
End If
For x As Long = 0 To DT.Rows.Count - 1
DT.Rows(x).Item(0) = FullPath & Mid(DT.Rows(x).Item(0),
Len(OldFullPath) +
1)
Next
DT.AcceptChanges() <-- has no effect
DA.Update(DT) <-- has no effect
rstSELECT.Dispose()



xPL Links: http://www.xplproject.org.uk http://www.xplhal.com http://www.xpl.myby.co.uk
To Post a Message: ukha_xpl@xxxxxxx
To Subscribe:  ukha_xpl-subscribe@xxxxxxx
To Unsubscribe:  ukha_xpl-unsubscribe@xxxxxxx

xPL Main Index | xPL Thread Index | xPL Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.